Evaluate global-config env on startup

This commit is contained in:
Nick O'Leary
2023-06-23 09:35:00 +01:00
parent 1c5fdb6ab6
commit f196493402
5 changed files with 45 additions and 58 deletions

View File

@@ -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