merge object settings into default settings

pull/2604/head
Peter 'Pita' Martischka 2015-04-11 22:01:46 +01:00
parent 8ed12c7776
commit fc0cac0cad
1 changed files with 6 additions and 1 deletions

View File

@ -28,6 +28,7 @@ var jsonminify = require("jsonminify");
var log4js = require("log4js");
var randomString = require("./randomstring");
var suppressDisableMsg = " -- To suppress these warning messages change suppressErrorsInPadText to true in your settings.json\n";
var _ = require("underscore");
/* Root path of the installation */
exports.root = path.normalize(path.join(npm.dir, ".."));
@ -272,7 +273,11 @@ exports.reloadSettings = function reloadSettings() {
//or it's a settings hash, specific to a plugin
if(exports[i] !== undefined || i.indexOf('ep_')==0)
{
exports[i] = settings[i];
if (_.isObject(settings[i]) && !_.isArray(settings[i])) {
exports[i] = _.defaults(settings[i], exports[i]);
} else {
exports[i] = settings[i];
}
}
//this setting is unkown, output a warning and throw it away
else