Ghost/core/server/config/index.js
kirrg001 7d3e8fa8a9 🔦 add nconf files
refs #6982
- add defaults.json
- add overrides.json
- add env specific default values
- add nconf wrapper in /config
- add config utils in /config/utils.js

[ci skip]
2016-09-20 15:59:34 +01:00

33 lines
722 B
JavaScript

var nconf = require('nconf'),
path = require('path'),
localUtils = require('./utils'),
env = process.env.NODE_ENV || 'development';
nconf.set('NODE_ENV', env);
/**
* command line arguments
*/
nconf.argv();
/**
* env arguments
*/
nconf.env();
/**
* load config files
*/
nconf.file('1', __dirname + '/overrides.json');
nconf.file('2', path.join(process.cwd(), 'config.' + env + '.json'));
nconf.file('3', __dirname + '/env/config.' + env + '.json');
nconf.file('4', __dirname + '/defaults.json');
/**
* transform all relative paths to absolute paths
*/
localUtils.makePathsAbsolute.bind(nconf)();
module.exports = nconf;
module.exports.isPrivacyDisabled = localUtils.isPrivacyDisabled.bind(nconf);