fastconf
Requires at least partial ES6 support (node v4 or higher)
npm install fastconf
fast example
console.log(process.env)
const config = fastconf([
['FOO_BAR', {type: Number}],
['NOPE', {type: Boolean, defaultValue: false}],
['MORE_THINGS', {defaultValue: 'apples'}]
], {
xbpf: {
prefix: 'XBPF_',
keys: [
'ZIG_ZAG'
]
}
})
console.log(config)
slow example
import fastconf from 'fastconf'
const config = fastconf({
prefix: 'NICE_',
normalizeNames: true,
strictExistence: false,
useProxy: false,
keys: [
['FOO_BAR', {
type: Number,
normalizeName: false,
strictExistence: true,
defaultValue: 0
}],
['MORE_THINGS', {type: String, defaultValue: null}]
]
}, {
xbpf: {
prefix: 'XBPF_',
keys: [
['ZIG_ZAG', {type: Number}]
]
}
}, {
'NICE_FOO_BAR': '123',
'XBPF_ZIG_ZAG': '2929'
})