36 lines
650 B
JavaScript
36 lines
650 B
JavaScript
|
import Nconf from 'nconf-lite'
|
||
|
|
||
|
const nconf = new Nconf()
|
||
|
|
||
|
// Helper method for global usage.
|
||
|
nconf.inTest = () => nconf.get('NODE_ENV') === 'test'
|
||
|
|
||
|
// Config follow the following priority check order:
|
||
|
// 1. Enviroment variables
|
||
|
// 2. package.json
|
||
|
// 3. config/config.json
|
||
|
// 4. config/config.default.json
|
||
|
|
||
|
// Load enviroment variables as first priority
|
||
|
nconf.env({
|
||
|
separator: '__',
|
||
|
whitelist: [
|
||
|
'NODE_ENV',
|
||
|
],
|
||
|
parseValues: true,
|
||
|
})
|
||
|
|
||
|
|
||
|
// Load empty overrides that can be overwritten later
|
||
|
nconf.overrides({})
|
||
|
|
||
|
nconf.defaults({
|
||
|
"NODE_ENV": "development",
|
||
|
"frontend": {
|
||
|
"url": "http://beta01.nfp.moe"
|
||
|
},
|
||
|
})
|
||
|
|
||
|
|
||
|
export default nconf
|