1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Be consistent in how node settings are addressed

This commit is contained in:
Nick O'Leary 2017-06-29 11:17:39 +01:00
parent 74ea85d19c
commit 710f1e2ca0
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 6 additions and 5 deletions

View File

@ -156,7 +156,7 @@
clearNameData("ca"); clearNameData("ca");
}); });
if (RED.settings.nodeSettings.tlsConfigDisableLocalFiles) { if (RED.settings.tlsConfigDisableLocalFiles) {
$("#node-config-row-uselocalfiles").hide(); $("#node-config-row-uselocalfiles").hide();
} else { } else {
$("#node-config-row-uselocalfiles").show(); $("#node-config-row-uselocalfiles").show();

View File

@ -117,7 +117,6 @@ var persistentSettings = {
nodeSettings[type] = opts; nodeSettings[type] = opts;
}, },
exportNodeSettings: function(safeSettings) { exportNodeSettings: function(safeSettings) {
safeSettings["nodeSettings"] = {};
for (var type in nodeSettings) { for (var type in nodeSettings) {
if (nodeSettings.hasOwnProperty(type) && !disableNodeSettings[type]) { if (nodeSettings.hasOwnProperty(type) && !disableNodeSettings[type]) {
var nodeTypeSettings = nodeSettings[type]; var nodeTypeSettings = nodeSettings[type];
@ -125,10 +124,12 @@ var persistentSettings = {
if (nodeTypeSettings.hasOwnProperty(property)) { if (nodeTypeSettings.hasOwnProperty(property)) {
var setting = nodeTypeSettings[property]; var setting = nodeTypeSettings[property];
if (setting.exportable) { if (setting.exportable) {
if (userSettings.hasOwnProperty(property)) { if (safeSettings.hasOwnProperty(property)) {
safeSettings["nodeSettings"][property] = userSettings[property]; // Cannot overwrite existing setting
} else if (userSettings.hasOwnProperty(property)) {
safeSettings[property] = userSettings[property];
} else if (setting.hasOwnProperty('value')) { } else if (setting.hasOwnProperty('value')) {
safeSettings["nodeSettings"][property] = setting.value; safeSettings[property] = setting.value;
} }
} }
} }