Apply envVarExcludes setting to RED.util.getSetting into the function node

This commit is contained in:
GogoVega 2024-10-23 12:15:24 +02:00
parent c363f375b6
commit 7555e0644f
No known key found for this signature in database
GPG Key ID: E1E048B63AC5AC2B

View File

@ -111,8 +111,6 @@ module.exports = function(RED) {
throw new Error(RED._("function.error.externalModuleNotAllowed"));
}
var functionText = "var results = null;"+
"results = (async function(msg,__send__,__done__){ "+
"var __msgid__ = msg._msgid;"+
@ -160,13 +158,26 @@ module.exports = function(RED) {
node.outstandingIntervals = [];
node.clearStatus = false;
const envVarExcludes = {};
if (RED.settings.envVarExcludes && Array.isArray(RED.settings.envVarExcludes)) {
RED.settings.envVarExcludes.forEach((e) => envVarExcludes[e] = true);
}
var sandbox = {
console:console,
util:util,
Buffer:Buffer,
Date: Date,
RED: {
util: RED.util
util: {
...RED.util,
getSetting: function (node, name, flow) {
if (envVarExcludes[name]) {
return undefined;
}
return RED.util.getSetting(node, name, flow);
}
}
},
__node__: {
id: node.id,