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

@@ -318,37 +318,6 @@ function parseConfig(config) {
return flow;
}
function getGlobalEnv(name) {
const nodes = _runtime.nodes;
if (!nodes) {
return null;
}
const gconf = nodes.getGlobalConfig();
const env = gconf ? gconf.env : null;
if (env) {
const cred = (gconf ? credentials.get(gconf.id) : null) || {
map: {}
};
const map = cred.map;
for (let i = 0; i < env.length; i++) {
const item = env[i];
if (item.name === name) {
if (item.type === "cred") {
return {
name: name,
value: map[name],
type: "cred"
};
}
return item;
}
}
}
return null;
}
module.exports = {
init: function(runtime) {
_runtime = runtime;
@@ -359,11 +328,6 @@ module.exports = {
},
getEnvVar: function(k) {
if (!envVarExcludes[k]) {
const item = getGlobalEnv(k);
if (item) {
const val = redUtil.evaluateNodeProperty(item.value, item.type, null, null, null);
return val;
}
return process.env[k];
}
return undefined;