bragg-load-config
v0.4.1
Published
Load a config file based upon the environment
Downloads
192
Maintainers
Readme
bragg-load-config
Load a config file based upon the environment
Install
$ npm install bragg-load-config
Usage
config.json
{
"production": {
"FooService": "foo:v0"
}
}
const app = require('bragg')();
const environment = require('bragg-env');
const loadConfig = require('bragg-load-config');
app.use(environment());
app.use(loadConfig('config.json'));
app.use(ctx => {
console.log(ctx.config);
/**
* {
* "FooService": "foo:v0"
* }
*/
});
Overrides
It's possible to override config data based upon the AWS Account ID.
{
"_overrides": {
"account:123456789012": {
"FooService": "foo:v1"
}
},
"production": {
"FooService": "foo:v0"
}
}
If the AWS Account ID matches 123456789012
, it will merge that config object with the specific environment config object.
API
loadConfig(filePath, [options])
filePath
Type: string
Path to the config file.
options
cwd
Type: string
Default: process.cwd()
Working directory of the config file.
Related
License
MIT © Sam Verschueren