mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fix env evaluation when one env references another in the same object
Fixes #4342
This commit is contained in:
parent
d9bbac20f3
commit
797cea5394
@ -112,6 +112,7 @@ async function evaluateEnvProperties(flow, env, credentials) {
|
|||||||
if (pendingEvaluations.length > 0) {
|
if (pendingEvaluations.length > 0) {
|
||||||
await Promise.all(pendingEvaluations)
|
await Promise.all(pendingEvaluations)
|
||||||
}
|
}
|
||||||
|
// Now loop over the env types and evaluate them properly
|
||||||
for (let i = 0; i < envTypes.length; i++) {
|
for (let i = 0; i < envTypes.length; i++) {
|
||||||
let { name, value, type } = envTypes[i]
|
let { name, value, type } = envTypes[i]
|
||||||
// If an env-var wants to lookup itself, delegate straight to the parent
|
// If an env-var wants to lookup itself, delegate straight to the parent
|
||||||
@ -122,7 +123,17 @@ async function evaluateEnvProperties(flow, env, credentials) {
|
|||||||
if (evaluatedEnv.hasOwnProperty(value)) {
|
if (evaluatedEnv.hasOwnProperty(value)) {
|
||||||
value = evaluatedEnv[value]
|
value = evaluatedEnv[value]
|
||||||
} else {
|
} else {
|
||||||
value = redUtil.evaluateNodeProperty(value, type, {_flow: flow}, null, null);
|
value = redUtil.evaluateNodeProperty(value, type, {_flow: {
|
||||||
|
// Provide a hook so when it tries to look up a flow setting,
|
||||||
|
// we can insert the just-evaluated value which hasn't yet
|
||||||
|
// been set on the flow object - otherwise delegate up to the flow
|
||||||
|
getSetting: function(name) {
|
||||||
|
if (evaluatedEnv.hasOwnProperty(name)){
|
||||||
|
return evaluatedEnv[name]
|
||||||
|
}
|
||||||
|
return flow.getSetting(name)
|
||||||
|
}
|
||||||
|
}}, null, null);
|
||||||
}
|
}
|
||||||
evaluatedEnv[name] = value
|
evaluatedEnv[name] = value
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user