@@ -34,7 +34,6 @@ import (
3434 "sync"
3535 "time"
3636
37- "github.com/AliceO2Group/Control/apricot"
3837 "github.com/AliceO2Group/Control/common/event"
3938 "github.com/AliceO2Group/Control/common/gera"
4039 "github.com/AliceO2Group/Control/common/logger"
@@ -68,14 +67,16 @@ type Environment struct {
6867 hookHandlerF func (hooks task.Tasks ) error
6968 incomingEvents chan event.DeviceEvent
7069
71- GlobalDefaults gera.StringMap // From Consul
72- GlobalVars gera.StringMap // From Consul
73- UserVars gera.StringMap // From user input
74- stateChangedCh chan * event.TasksStateChangedEvent
75- unsubscribe chan struct {}
76- eventStream Subscription
77- Public bool // From workflow or user
78- Description string // From workflow
70+ GlobalDefaults gera.StringMap // From Consul
71+ GlobalVars gera.StringMap // From Consul
72+ UserVars gera.StringMap // From user input
73+ BaseConfigStack map [string ]string // Exclusively from Consul, already flattened for performance
74+
75+ stateChangedCh chan * event.TasksStateChangedEvent
76+ unsubscribe chan struct {}
77+ eventStream Subscription
78+ Public bool // From workflow or user
79+ Description string // From workflow
7980
8081 callsPendingAwait map [string ] /*await expression, trigger only*/ callable.CallsMap
8182
@@ -123,6 +124,12 @@ func newEnvironment(userVars map[string]string) (env *Environment, err error) {
123124 )
124125 env .GlobalVars .Set ("__fmq_cleanup_count" , "0" ) // initialize to 0 the number of START transitions
125126
127+ env .BaseConfigStack , err = gera .MakeStringMapWithMap (env .GlobalVars .Raw ()).
128+ WrappedAndFlattened (gera .MakeStringMapWithMap (env .GlobalDefaults .Raw ())) // prepare the base config stack
129+ if err != nil {
130+ return nil , err
131+ }
132+
126133 // We start with STANDBY, which will not be preceded with enter_STANDBY, thus we set the value here.
127134 enterStateTimeMs := strconv .FormatInt (time .Now ().UnixMilli (), 10 )
128135 env .UserVars .Set ("enter_state_time_ms" , enterStateTimeMs )
@@ -171,14 +178,12 @@ func newEnvironment(userVars map[string]string) (env *Environment, err error) {
171178 }
172179 env .GlobalVars .Set ("__fmq_cleanup_count" , strconv .Itoa (cleanupCount )) // number of times the START transition has run for this env
173180
174- configStack , err := gera .MakeStringMapWithMap (apricot .Instance ().GetVars ()).
175- WrappedAndFlattened (gera .MakeStringMapWithMap (the .ConfSvc ().GetDefaults ()))
176181 if err == nil {
177- lhcPeriod , ok := configStack ["lhc_period" ]
182+ lhcPeriod , ok := env . BaseConfigStack ["lhc_period" ]
178183 if ok {
179184 env .workflow .GetVars ().Set ("lhc_period" , lhcPeriod )
180185 }
181- nHbfPerTf , ok := configStack ["n_hbf_per_tf" ]
186+ nHbfPerTf , ok := env . BaseConfigStack ["n_hbf_per_tf" ]
182187 if ok {
183188 env .workflow .GetVars ().Set ("n_hbf_per_tf" , nHbfPerTf )
184189 }
0 commit comments