mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-14 18:52:05 +03:00
27 lines
747 B
JavaScript
27 lines
747 B
JavaScript
|
var _ = require('lodash'),
|
||
|
config = require('../../server/config'),
|
||
|
origConfig = _.cloneDeep(config),
|
||
|
|
||
|
configUtils = {};
|
||
|
|
||
|
configUtils.config = config;
|
||
|
configUtils.defaultConfig = _.cloneDeep(config.get());
|
||
|
|
||
|
configUtils.set = function (newConfig) {
|
||
|
config.set(newConfig);
|
||
|
};
|
||
|
|
||
|
configUtils.restore = function () {
|
||
|
var topLevelOptional = ['mail', 'updateCheck', 'storage', 'forceAdminSSL', 'urlSSL', 'compress', 'privacy'];
|
||
|
|
||
|
config.set(_.merge({}, origConfig, configUtils.defaultConfig));
|
||
|
// @TODO make this horror go away
|
||
|
_.each(topLevelOptional, function (option) {
|
||
|
if (origConfig[option] === undefined) {
|
||
|
delete config[option];
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
|
||
|
module.exports = configUtils;
|