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

@@ -359,7 +359,7 @@ async function start(type,diff,muteLog,isDeploy) {
if (activeFlowConfig.flows.hasOwnProperty(id)) {
if (!activeFlowConfig.flows[id].disabled && !activeFlows[id]) {
// This flow is not disabled, nor is it currently active, so create it
activeFlows[id] = Flow.create(flowAPI,activeFlowConfig,activeFlowConfig.flows[id]);
activeFlows[id] = Flow.create(activeFlows['global'],activeFlowConfig,activeFlowConfig.flows[id]);
log.debug("red/nodes/flows.start : starting flow : "+id);
} else {
log.debug("red/nodes/flows.start : not starting disabled flow : "+id);
@@ -379,7 +379,7 @@ async function start(type,diff,muteLog,isDeploy) {
activeFlows[id].update(activeFlowConfig,activeFlowConfig.flows[id]);
} else {
// This flow didn't previously exist, so create it
activeFlows[id] = Flow.create(flowAPI,activeFlowConfig,activeFlowConfig.flows[id]);
activeFlows[id] = Flow.create(activeFlows['global'],activeFlowConfig,activeFlowConfig.flows[id]);
log.debug("red/nodes/flows.start : starting flow : "+id);
}
} else {
@@ -784,17 +784,6 @@ const flowAPI = {
log: m => log.log(m)
}
function getGlobalConfig() {
let gconf = null;
eachNode((n) => {
if (n.type === "global-config") {
gconf = n;
}
});
return gconf;
}
module.exports = {
init: init,
@@ -807,10 +796,7 @@ module.exports = {
get:getNode,
eachNode: eachNode,
getGlobalConfig: getGlobalConfig,
/**
* Gets the current flow configuration
*/