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.AddConfigPath(".")
|
||||||
viper.SetConfigName("config")
|
viper.SetConfigName("config")
|
||||||
err = viper.ReadInConfig()
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err.Error())
|
|
||||||
log.Println("Using default config.")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if CacheType.GetString() == "keyvalue" {
|
if CacheType.GetString() == "keyvalue" {
|
||||||
CacheType.Set(KeyvalueType.GetString())
|
CacheType.Set(KeyvalueType.GetString())
|
||||||
|
@ -395,7 +389,18 @@ func InitConfig() {
|
||||||
MetricsEnabled.Set(true)
|
MetricsEnabled.Set(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Using config file: %s", viper.ConfigFileUsed())
|
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) {
|
func random(length int) (string, error) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue