Description

Env-based config loader

Features

  • Env config loader middleware

Example

./index.ts

import { inject, container, Types, Core } from '@biorate/inversion';
import { IConfig, Config } from '@biorate/config';
import { ConfigLoader } from '@biorate/config-loader';
import { ConfigLoaderEnv } from '@biorate/config-loader-env';

class Root extends Core() {
@inject(Types.Config) public config: IConfig;
@inject(Types.ConfigLoaderEnv) public configLoaderEnv: ConfigLoader;
}

container.bind<IConfig>(Types.Config).to(Config).inSingletonScope();
container.bind<ConfigLoader>(Types.ConfigLoaderEnv).to(ConfigLoaderEnv).inSingletonScope();
container.bind<Root>(Root).toSelf().inSingletonScope();

(async () => {
const root = container.get<Root>(Root);
await root.$run();
root.config.get('test'); // Hello world!
})();

See

@biorate/config-loader docs for details

Hierarchy

Constructors

Properties

Methods

Constructors

Properties

config: IConfig

Description

Config dependency

Methods

Generated using TypeDoc