Skip to content

Commit

Permalink
Ensure creds object is not undefined when evaling env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
knolleary committed Sep 25, 2023
1 parent 41797f8 commit c9320c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/node_modules/@node-red/runtime/lib/flows/Flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ class Flow {
for (let i = 0; i < configNodes.length; i++) {
const node = this.flow.configs[configNodes[i]]
if (node.type === 'global-config' && node.env) {
const nodeEnv = await flowUtil.evaluateEnvProperties(this, node.env, credentials.get(node.id) || {})
const nodeEnv = await flowUtil.evaluateEnvProperties(this, node.env, credentials.get(node.id))
this._env = { ...this._env, ...nodeEnv }
}
}
}

if (this.env) {
this._env = { ...this._env, ...await flowUtil.evaluateEnvProperties(this, this.env, credentials.get(this.id) || {}) }
this._env = { ...this._env, ...await flowUtil.evaluateEnvProperties(this, this.env, credentials.get(this.id)) }
}

// Initialise the group objects. These must be done in the right order
Expand Down
1 change: 1 addition & 0 deletions packages/node_modules/@node-red/runtime/lib/flows/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ function mapEnvVarProperties(obj,prop,flow,config) {
}

async function evaluateEnvProperties(flow, env, credentials) {
credentials = credentials || {}
const pendingEvaluations = []
const evaluatedEnv = {}
const envTypes = []
Expand Down

0 comments on commit c9320c1

Please sign in to comment.