fix: clarify which config file is used on startup
This commit is contained in:
parent
2bc82bc1a0
commit
44aaf0a4ec
1 changed files with 12 additions and 7 deletions
|
@ -355,12 +355,6 @@ func InitConfig() {
|
|||
|
||||
viper.AddConfigPath(".")
|
||||
viper.SetConfigName("config")
|
||||
err = viper.ReadInConfig()
|
||||
if err != nil {
|
||||
log.Println(err.Error())
|
||||
log.Println("Using default config.")
|
||||
return
|
||||
}
|
||||
|
||||
if CacheType.GetString() == "keyvalue" {
|
||||
CacheType.Set(KeyvalueType.GetString())
|
||||
|
@ -395,7 +389,18 @@ func InitConfig() {
|
|||
MetricsEnabled.Set(true)
|
||||
}
|
||||
|
||||
if viper.ConfigFileUsed() != "" {
|
||||
log.Printf("Using config file: %s", viper.ConfigFileUsed())
|
||||
|
||||
err = viper.ReadInConfig()
|
||||
if err != nil {
|
||||
log.Println(err.Error())
|
||||
log.Println("Using default config.")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
log.Println("No config file found, using default or config from environment variables.")
|
||||
}
|
||||
}
|
||||
|
||||
func random(length int) (string, error) {
|
||||
|
|
Loading…
Reference in a new issue