mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 03:12:54 +03:00
7d3e8fa8a9
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]
38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
var path = require('path'),
|
|
_ = require('lodash');
|
|
|
|
exports.isPrivacyDisabled = function isPrivacyDisabled(privacyFlag) {
|
|
if (!this.get('privacy')) {
|
|
return false;
|
|
}
|
|
|
|
if (this.get('privacy').useTinfoil === true) {
|
|
return true;
|
|
}
|
|
|
|
return this.get('privacy')[privacyFlag] === false;
|
|
};
|
|
|
|
/**
|
|
* transform all relative paths to absolute paths
|
|
* @TODO: imagesRelPath is a dirty little attribute (especially when looking at the usages)
|
|
*/
|
|
exports.makePathsAbsolute = function makePathsAbsolute(paths, parent) {
|
|
var self = this;
|
|
|
|
if (!paths && !parent) {
|
|
paths = this.get('paths');
|
|
parent = 'paths';
|
|
}
|
|
|
|
_.each(paths, function (configValue, pathsKey) {
|
|
if (_.isObject(configValue)) {
|
|
makePathsAbsolute.bind(self)(configValue, parent + ':' + pathsKey);
|
|
} else {
|
|
if (configValue[0] !== '/' && pathsKey !== 'imagesRelPath') {
|
|
self.set(parent + ':' + pathsKey, path.join(__dirname + '/../../../', configValue));
|
|
}
|
|
}
|
|
});
|
|
};
|