bb07096b9d
refs #7492 - this is just a temporary solution
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
var nconf = require('nconf'),
|
|
path = require('path'),
|
|
localUtils = require('./utils'),
|
|
packageInfo = require('../../../package.json'),
|
|
env = process.env.NODE_ENV || 'development';
|
|
|
|
nconf.set('NODE_ENV', env);
|
|
|
|
/**
|
|
* command line arguments
|
|
*/
|
|
nconf.argv();
|
|
|
|
/**
|
|
* env arguments
|
|
*/
|
|
nconf.env();
|
|
|
|
/**
|
|
* load config files
|
|
* @TODO:
|
|
* - why does this work? i have no idea!
|
|
* - find out why argv override works, when defining these weird keys
|
|
* - i could not find any nconf usages so that all config requirements work
|
|
*/
|
|
nconf.file('ghost1', __dirname + '/overrides.json');
|
|
nconf.file('ghost2', path.join(process.cwd(), 'config.' + env + '.json'));
|
|
nconf.file('ghost3', __dirname + '/env/config.' + env + '.json');
|
|
nconf.file('ghost4', __dirname + '/defaults.json');
|
|
|
|
/**
|
|
* transform all relative paths to absolute paths
|
|
*/
|
|
localUtils.makePathsAbsolute.bind(nconf)();
|
|
|
|
/**
|
|
* values we have to set manual
|
|
* @TODO: ghost-cli?
|
|
*/
|
|
nconf.set('ghostVersion', packageInfo.version);
|
|
|
|
module.exports = nconf;
|
|
module.exports.isPrivacyDisabled = localUtils.isPrivacyDisabled.bind(nconf);
|
|
module.exports.getContentPath = localUtils.getContentPath.bind(nconf);
|