The config structure itself is a critical section.
diff --git a/config/config.go b/config/config.go index 996a0d3..b9e9a94 100644 --- a/config/config.go +++ b/config/config.go
@@ -24,6 +24,8 @@ defaultConfigPath = "." ) +var configlock sync.Mutex + type ConfigMgr struct { sync.Mutex vcfg *viper.Viper @@ -87,6 +89,8 @@ } func GetConfig() apid.ConfigService { + configlock.Lock() + defer configlock.Unlock() if cfg == nil { vcfg := viper.New()