mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
parent
216db60e74
commit
d6d343865b
3 changed files with 21 additions and 0 deletions
|
@ -43,6 +43,7 @@ _private.loadNconf = function loadNconf(options) {
|
||||||
nconf.isPrivacyDisabled = localUtils.isPrivacyDisabled.bind(nconf);
|
nconf.isPrivacyDisabled = localUtils.isPrivacyDisabled.bind(nconf);
|
||||||
nconf.getContentPath = localUtils.getContentPath.bind(nconf);
|
nconf.getContentPath = localUtils.getContentPath.bind(nconf);
|
||||||
nconf.sanitizeDatabaseProperties = localUtils.sanitizeDatabaseProperties.bind(nconf);
|
nconf.sanitizeDatabaseProperties = localUtils.sanitizeDatabaseProperties.bind(nconf);
|
||||||
|
nconf.doesContentPathExist = localUtils.doesContentPathExist.bind(nconf);
|
||||||
|
|
||||||
nconf.sanitizeDatabaseProperties();
|
nconf.sanitizeDatabaseProperties();
|
||||||
nconf.makePathsAbsolute(nconf.get('paths'), 'paths');
|
nconf.makePathsAbsolute(nconf.get('paths'), 'paths');
|
||||||
|
@ -54,6 +55,11 @@ _private.loadNconf = function loadNconf(options) {
|
||||||
nconf.checkUrlProtocol = localUtils.checkUrlProtocol.bind(nconf);
|
nconf.checkUrlProtocol = localUtils.checkUrlProtocol.bind(nconf);
|
||||||
nconf.checkUrlProtocol();
|
nconf.checkUrlProtocol();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure that the content path exists
|
||||||
|
*/
|
||||||
|
nconf.doesContentPathExist();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* values we have to set manual
|
* values we have to set manual
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
var path = require('path'),
|
var path = require('path'),
|
||||||
|
fs = require('fs-extra'),
|
||||||
_ = require('lodash');
|
_ = require('lodash');
|
||||||
|
|
||||||
exports.isPrivacyDisabled = function isPrivacyDisabled(privacyFlag) {
|
exports.isPrivacyDisabled = function isPrivacyDisabled(privacyFlag) {
|
||||||
|
@ -68,6 +69,16 @@ exports.getContentPath = function getContentPath(type) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @TODO:
|
||||||
|
* - content/logs folder is required right now, otherwise Ghost want start
|
||||||
|
*/
|
||||||
|
exports.doesContentPathExist = function doesContentPathExist() {
|
||||||
|
if (!fs.pathExistsSync(this.get('paths:contentPath'))) {
|
||||||
|
throw new Error('Your content path does not exist! Please double check `paths.contentPath` in your custom config file e.g. config.production.json.');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the URL in config has a protocol and sanitise it if not including a warning that it should be changed
|
* Check if the URL in config has a protocol and sanitise it if not including a warning that it should be changed
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -22,6 +22,10 @@ describe('Config', function () {
|
||||||
originalEnv = _.clone(process.env);
|
originalEnv = _.clone(process.env);
|
||||||
originalArgv = _.clone(process.argv);
|
originalArgv = _.clone(process.argv);
|
||||||
config = rewire('../../../server/config');
|
config = rewire('../../../server/config');
|
||||||
|
|
||||||
|
// we manually call `loadConf` in the tests and we need to ensure that the minimum
|
||||||
|
// required config properties are available
|
||||||
|
process.env['paths__contentPath'] = 'content/';
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
|
|
Loading…
Add table
Reference in a new issue