1.76.3 • Published 12 months ago

@biorate/config-loader-fs v1.76.3

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

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

MIT

Copyright (c) 2021-present Leonid Levkin (llevkin)

1.76.3

12 months ago

1.65.4

1 year ago

1.54.0

1 year ago

1.38.2

2 years ago

1.38.3

2 years ago

1.38.1

2 years ago

1.38.4

2 years ago

1.42.2

2 years ago

1.42.1

2 years ago

1.30.12

2 years ago

1.29.0

2 years ago

1.28.1

2 years ago

1.28.0

2 years ago

1.30.2

2 years ago

1.30.0

2 years ago

1.30.1

2 years ago

1.26.0

2 years ago

1.27.2

2 years ago

1.27.0

2 years ago

1.27.1

2 years ago

1.24.0

2 years ago

1.11.2

3 years ago

1.7.0

3 years ago

1.6.0

3 years ago