From f626ee060a73eb0ed89fd2521f765b79c7982461 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 19 Oct 2015 14:44:54 +0100 Subject: [PATCH] Allow properties to be specified by environment variables A property set to $(ABC) will be substituted with the environment variable ABC - if it exists. If the property doesn't exist, the property is left unchanged. --- red/nodes/Flow.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/red/nodes/Flow.js b/red/nodes/Flow.js index 2e3607a47..bec251138 100644 --- a/red/nodes/Flow.js +++ b/red/nodes/Flow.js @@ -27,10 +27,42 @@ function getID() { return (1+Math.random()*4294967295).toString(16); } +var EnvVarPropertyRE = /^\$\((\S+)\)$/; + +function mapEnvVarProperties(obj,prop) { + if (Buffer.isBuffer(obj[prop])) { + return; + } else if (Array.isArray(obj[prop])) { + for (var i=0;i