mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Evaluate global-config env on startup
This commit is contained in:
@@ -172,11 +172,24 @@ class Flow {
|
||||
this.statusNodes = [];
|
||||
this.completeNodeMap = {};
|
||||
|
||||
if (this.env) {
|
||||
this._env = await flowUtil.evaluateEnvProperties(this, this.env, credentials.get(this.id))
|
||||
// console.log('env', this.env)
|
||||
// console.log('_env', this._env)
|
||||
|
||||
if (this.isGlobalFlow) {
|
||||
// This is the global flow. It needs to go find the `global-config`
|
||||
// node and extract any env properties from it
|
||||
const configNodes = Object.keys(this.flow.configs);
|
||||
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))
|
||||
this._env = { ...this._env, ...nodeEnv }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.env) {
|
||||
this._env = { ...this._env, ...await flowUtil.evaluateEnvProperties(this, this.env, credentials.get(this.id)) }
|
||||
}
|
||||
|
||||
for (let i = 0; i < this.groupOrder.length; i++) {
|
||||
// Start the groups in the right order so they
|
||||
// can setup their env vars knowning their parent
|
||||
|
||||
Reference in New Issue
Block a user