mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00: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:
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
|
||||
*/
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user