mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
59e2694acf
* 💄 Combine slashes & uncapitalise middleware - these bits of middleware belong together - ideally they should be optimised * 🎨 Move ghostLocals out of themeHandler GhostLocals sets several important values which are needed for every part of the application, admin, api and theme. Therefore, it doesn't make sense for it to be bundled in the themeHandler. * 🐛 Fix the uncapitalise middleware - Updated to make correct use of req.baseUrl, req.path, req.url & req.originalUrl - Updated the tests to actually cover our weird cases * 🎨 Move ghostVersion logic out of config * 💄 Group static / asset-related middleware together * 🔥 Remove /shared/ asset handling - The 5 files which are located in `/shared/` are all handled by individual calls to `serveSharedFile` - Therefore this code is redundant
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
var Nconf = require('nconf'),
|
|
nconf = new Nconf.Provider(),
|
|
path = require('path'),
|
|
localUtils = require('./utils'),
|
|
env = process.env.NODE_ENV || 'development';
|
|
|
|
/**
|
|
* command line arguments
|
|
*/
|
|
nconf.argv();
|
|
|
|
/**
|
|
* env arguments
|
|
*/
|
|
nconf.env({
|
|
separator: '__'
|
|
});
|
|
|
|
/**
|
|
* 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
|
|
*/
|
|
nconf.set('env', env);
|
|
|
|
module.exports = nconf;
|
|
module.exports.isPrivacyDisabled = localUtils.isPrivacyDisabled.bind(nconf);
|
|
module.exports.getContentPath = localUtils.getContentPath.bind(nconf);
|