conf singleton issue

This commit is contained in:
ycc
2024-09-04 14:21:01 +02:00
parent a0cbf9ac6f
commit ad96b50464
2 changed files with 9 additions and 4 deletions

View File

@@ -37,7 +37,7 @@ func GetConfig() *Config {
}
func SetConfig(mongoUrl string, database string, natsUrl string, lokiUrl string, logLevel string) *Config {
once.Do(func() {
/*once.Do(func() {
instance = &Config{
MongoUrl: mongoUrl,
MongoDatabase: database,
@@ -45,6 +45,11 @@ func SetConfig(mongoUrl string, database string, natsUrl string, lokiUrl string,
LokiUrl: lokiUrl,
LogLevel: logLevel,
}
})
return instance
})*/
GetConfig().MongoUrl = mongoUrl
GetConfig().MongoDatabase = database
GetConfig().NATSUrl = natsUrl
GetConfig().LokiUrl = lokiUrl
GetConfig().LogLevel = logLevel
return GetConfig()
}