Env-based config loader
./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!})(); Copy
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!})();
@biorate/config-loader docs for details
Protected
Readonly
Config dependency
Initialize
Generated using TypeDoc
Description
Env-based config loader
Features
Example
./index.ts
See
@biorate/config-loader docs for details