1.76.3 • Published 12 months ago

@biorate/file-config v1.76.3

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

File Config

Module for configuring the application using files, extends Config base class.

Examples:

In cwd of you app, near package.json, create 2 files:

# config.json
{
  "app": "test"
}
# config.debug.json:
{
  "title": "My awesome app"
}
import { Core, injectable, inject, container, Types } from '@biorate/inversion';
import { IConfig } from '@biorate/config';
import { FileConfig } from '@biorate/file-config';

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

container.bind<IConfig>(Types.Config)
 .to(FileConfig)
 .inSingletonScope();

container.bind<Root>(Root).toSelf().inSingletonScope();

(async () => {
  const root = await container.get(Root).$run();

  console.log(root.config.get('package'));
  // {
  //   "name": "file-config-test",
  //   "version": "0.0.0",
  //   "description": "Test package.json",
  //   "keywords": [],
  //   "author": "llevkin",
  //   "license": "MIT"
  // }

  console.log(root.config.get('app')); // test
  console.log(root.config.get('title')); // My awesome app
})();

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.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

1.0.0

3 years ago

1.4.0

3 years ago

1.2.2

3 years ago

0.30.9

3 years ago

0.30.7

3 years ago

0.30.6

3 years ago

0.30.5

3 years ago

0.30.11

3 years ago

0.30.14

3 years ago

0.30.2

3 years ago

0.30.0

3 years ago

0.30.19

3 years ago

0.29.1

3 years ago

0.28.0

3 years ago

0.27.0

3 years ago

0.26.0

3 years ago

0.25.0

3 years ago

0.21.0

3 years ago

0.20.0

3 years ago

0.19.0

3 years ago

0.18.2

3 years ago

0.23.0

3 years ago

0.22.0

3 years ago

0.18.1

3 years ago

0.18.0

3 years ago

0.17.1

3 years ago

0.16.2

3 years ago

0.16.1

3 years ago