1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Ensure creds object is not undefined when evaling env vars

This commit is contained in:
Nick O'Leary 2023-09-25 18:08:02 +01:00
parent 41797f8cef
commit c9320c190d
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 3 additions and 2 deletions

View File

@ -161,14 +161,14 @@ class Flow {
for (let i = 0; i < configNodes.length; i++) { for (let i = 0; i < configNodes.length; i++) {
const node = this.flow.configs[configNodes[i]] const node = this.flow.configs[configNodes[i]]
if (node.type === 'global-config' && node.env) { 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 } this._env = { ...this._env, ...nodeEnv }
} }
} }
} }
if (this.env) { 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 // Initialise the group objects. These must be done in the right order

View File

@ -80,6 +80,7 @@ function mapEnvVarProperties(obj,prop,flow,config) {
} }
async function evaluateEnvProperties(flow, env, credentials) { async function evaluateEnvProperties(flow, env, credentials) {
credentials = credentials || {}
const pendingEvaluations = [] const pendingEvaluations = []
const evaluatedEnv = {} const evaluatedEnv = {}
const envTypes = [] const envTypes = []