mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Do not convert falsey env vars to blank string
Only blank out undefined as that's what we've always done
This commit is contained in:
parent
e843f192ec
commit
db3eee72b5
@ -38,7 +38,6 @@ class Subflow extends Flow {
|
|||||||
* @param {[type]} subflowInstance [description]
|
* @param {[type]} subflowInstance [description]
|
||||||
*/
|
*/
|
||||||
constructor(parent,globalFlow,subflowDef,subflowInstance) {
|
constructor(parent,globalFlow,subflowDef,subflowInstance) {
|
||||||
console.log(subflowDef);
|
|
||||||
// console.log("CREATE SUBFLOW",subflowDef.id,subflowInstance.id);
|
// console.log("CREATE SUBFLOW",subflowDef.id,subflowInstance.id);
|
||||||
// console.log("SubflowInstance\n"+JSON.stringify(subflowInstance," ",2));
|
// console.log("SubflowInstance\n"+JSON.stringify(subflowInstance," ",2));
|
||||||
// console.log("SubflowDef\n"+JSON.stringify(subflowDef," ",2));
|
// console.log("SubflowDef\n"+JSON.stringify(subflowDef," ",2));
|
||||||
|
11
packages/node_modules/@node-red/util/lib/util.js
vendored
11
packages/node_modules/@node-red/util/lib/util.js
vendored
@ -442,22 +442,23 @@ function getSetting(node, name) {
|
|||||||
* @memberof @node-red/util_util
|
* @memberof @node-red/util_util
|
||||||
*/
|
*/
|
||||||
function evaluateEnvProperty(value, node) {
|
function evaluateEnvProperty(value, node) {
|
||||||
|
var result;
|
||||||
if (/^\${[^}]+}$/.test(value)) {
|
if (/^\${[^}]+}$/.test(value)) {
|
||||||
// ${ENV_VAR}
|
// ${ENV_VAR}
|
||||||
var name = value.substring(2,value.length-1);
|
var name = value.substring(2,value.length-1);
|
||||||
var val = getSetting(node, name);
|
result = getSetting(node, name);
|
||||||
return val ? val : "";
|
|
||||||
} else if (!/\${\S+}/.test(value)) {
|
} else if (!/\${\S+}/.test(value)) {
|
||||||
// ENV_VAR
|
// ENV_VAR
|
||||||
var val = getSetting(node, value);
|
result = getSetting(node, value);
|
||||||
return val ? val : "";
|
|
||||||
} else {
|
} else {
|
||||||
// FOO${ENV_VAR}BAR
|
// FOO${ENV_VAR}BAR
|
||||||
return value.replace(/\${([^}]+)}/g, function(match, name) {
|
return value.replace(/\${([^}]+)}/g, function(match, name) {
|
||||||
var val = getSetting(node, name);
|
var val = getSetting(node, name);
|
||||||
return (val ? val : "");
|
return (val === undefined)?"":val;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
return (result === undefined)?"":result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user