@biorate/config-loader-fs
v1.76.3
Published
Config loader for filesystem's config
Downloads
40
Readme
File config loader
File-based config loader
Features
- File config loader middleware
- Basic configuration in config.json
- Env-based configuration in config.{NODE_ENV}.json
Examples
./config.json
{
"hello": "world"
}
./index.ts
import { inject, container, Types, Core } from '@biorate/inversion';
import { IConfig, Config } from '@biorate/config';
import { ConfigLoader } from '@biorate/config-loader';
import { ConfigLoaderFs } from '@biorate/config-loader-fs';
class Root extends Core() {
@inject(Types.Config) public config: IConfig;
@inject(Types.ConfigLoaderFs) public configLoaderFs: ConfigLoader;
}
container.bind<IConfig>(Types.Config).to(Config).inSingletonScope();
container.bind<ConfigLoader>(Types.ConfigLoaderFs).to(ConfigLoaderFs).inSingletonScope();
container.bind<Root>(Root).toSelf().inSingletonScope();
(async () => {
const root = container.get<Root>(Root);
await root.$run();
root.config.get('hello'); // world
})();
See
@biorate/config-loader docs for details
Learn
- Documentation can be found here - docs.
Release History
See the CHANGELOG
License
Copyright (c) 2021-present Leonid Levkin (llevkin)