From db3eee72b5798facb7bfeccd2551e1aef724b460 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 4 Feb 2019 14:12:34 +0000 Subject: [PATCH] Do not convert falsey env vars to blank string Only blank out undefined as that's what we've always done --- .../@node-red/runtime/lib/nodes/flows/Subflow.js | 1 - packages/node_modules/@node-red/util/lib/util.js | 11 ++++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/node_modules/@node-red/runtime/lib/nodes/flows/Subflow.js b/packages/node_modules/@node-red/runtime/lib/nodes/flows/Subflow.js index 4b121668e..b13100f30 100644 --- a/packages/node_modules/@node-red/runtime/lib/nodes/flows/Subflow.js +++ b/packages/node_modules/@node-red/runtime/lib/nodes/flows/Subflow.js @@ -38,7 +38,6 @@ class Subflow extends Flow { * @param {[type]} subflowInstance [description] */ constructor(parent,globalFlow,subflowDef,subflowInstance) { - console.log(subflowDef); // console.log("CREATE SUBFLOW",subflowDef.id,subflowInstance.id); // console.log("SubflowInstance\n"+JSON.stringify(subflowInstance," ",2)); // console.log("SubflowDef\n"+JSON.stringify(subflowDef," ",2)); diff --git a/packages/node_modules/@node-red/util/lib/util.js b/packages/node_modules/@node-red/util/lib/util.js index a959e617c..3283a621b 100644 --- a/packages/node_modules/@node-red/util/lib/util.js +++ b/packages/node_modules/@node-red/util/lib/util.js @@ -442,22 +442,23 @@ function getSetting(node, name) { * @memberof @node-red/util_util */ function evaluateEnvProperty(value, node) { + var result; if (/^\${[^}]+}$/.test(value)) { // ${ENV_VAR} var name = value.substring(2,value.length-1); - var val = getSetting(node, name); - return val ? val : ""; + result = getSetting(node, name); } else if (!/\${\S+}/.test(value)) { // ENV_VAR - var val = getSetting(node, value); - return val ? val : ""; + result = getSetting(node, value); } else { // FOO${ENV_VAR}BAR return value.replace(/\${([^}]+)}/g, function(match, name) { var val = getSetting(node, name); - return (val ? val : ""); + return (val === undefined)?"":val; }); } + return (result === undefined)?"":result; + }