mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add the node setting tlsConfigDisableLocalFiles for tls node. (#1190)
* Add the node setting tlsConfigDisableLocalFiles for tls node. * Fix the bug that shows node setting when specified in settings.js and exportable is false.
This commit is contained in:
parent
34089aec70
commit
3b3d696e45
@ -48,7 +48,14 @@ module.exports = function(RED) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
RED.nodes.registerType("tls-config",TLSConfig);
|
||||
RED.nodes.registerType("tls-config",TLSConfig,{
|
||||
settings: {
|
||||
tlsConfigDisableLocalFiles: {
|
||||
value: true,
|
||||
exportable: false
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
TLSConfig.prototype.addTLSOptions = function(opts) {
|
||||
if (this.valid) {
|
||||
|
@ -128,10 +128,12 @@ var persistentSettings = {
|
||||
for (var property in nodeTypeSettings) {
|
||||
if (nodeTypeSettings.hasOwnProperty(property)) {
|
||||
var setting = nodeTypeSettings[property];
|
||||
if (userSettings.hasOwnProperty(property)) {
|
||||
safeSettings["nodeSettings"][property] = userSettings[property];
|
||||
} else if (setting.exportable) {
|
||||
safeSettings["nodeSettings"][property] = setting.value;
|
||||
if (setting.exportable) {
|
||||
if (userSettings.hasOwnProperty(property)) {
|
||||
safeSettings["nodeSettings"][property] = userSettings[property];
|
||||
} else {
|
||||
safeSettings["nodeSettings"][property] = setting.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -185,14 +185,16 @@ describe("red/settings", function() {
|
||||
var userSettings = {
|
||||
injectColor: "green",
|
||||
mqttColor: "yellow",
|
||||
c: [1,2,3]
|
||||
abColor: [1,2,3]
|
||||
}
|
||||
settings.init(userSettings);
|
||||
settings.registerNodeSettings("inject", {injectColor:{value:"red", exportable:true}} );
|
||||
settings.registerNodeSettings("ab", {abColor:{value:"red", exportable:false}} );
|
||||
var safeSettings = {};
|
||||
settings.exportNodeSettings(safeSettings);
|
||||
safeSettings["nodeSettings"].should.have.property("injectColor", "green");
|
||||
safeSettings["nodeSettings"].should.not.have.property("mqttColor");
|
||||
safeSettings["nodeSettings"].should.not.have.property("abColor");
|
||||
});
|
||||
|
||||
it('disables/enables node settings', function() {
|
||||
|
Loading…
Reference in New Issue
Block a user