@webbeds/configjs
v0.0.1-alpha.1530786865
Published
Overridable configs.
Downloads
2
Maintainers
Keywords
Readme
Config
Overridable configs.
npm install --save @webbeds/configjs
Usage
import { loadConfig } from '@webbeds/configjs'
import {baseConfig, overrides} from './common/config'
const actualConfig = loadConfig(baseConfig, overrides)
It will override base values with those in the override specified by
environment variable CONFIG_OVERRIDE_NAME
.
Powershell
$env:CONFIG_OVERRIDE_NAME='environment'
Cmd
set CONFIG_OVERRIDE_NAME='environment'
Define the overrides
export const baseConfig = {
topLevelProp1: 'value1',
structuredProp1: {
nestedInner11: 1,
nestedInner12: 'value1'
}
}
export const env1 = { /* What ever values you would like to override */ }
export const env2 = { /* What ever values you would like to override */ }
export const overrides = {
env1,
env2
}
Manually specify the override
Not really sure if it might be useful, but:
const actualConfig = loadConfig(baseConfig, overrides, 'env1')