@restorecommerce/service-config v1.0.15
@restorecommerce/service-config
An opinionated wrapper of nconf.
Configuration settings are obtain from the following sources in the given order:
- Command argument
- Environment variables
- Configuration files
1.) and 2.) support passing nested object properties with the following pattern:
# Original Configuration JSON file
{
"someObject": {
"paramA": "A"
}
}
Can be overridden via env var or command line parameter someObject__paramA
.
So the nesting is designated by a double underscore.
3.) tries to load the following configuration files from the
cfg
folder:
- Default configuration file
config.json
- Additional sub-variants added to the value of the environment variable
NODE_ENV
for example a valuedevelopment:development
would try to loadconfig_development.json
Usage
import { createServiceConfig } from '@restorecommerce/service-config';
...
const cfg = createServiceConfig('./test', { stageVar: 'NODE_ENV', logger: logger});
const testSetting = cfg.get('test');
6 months ago
6 months ago
7 months ago
10 months ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
7 years ago
7 years ago