Fix searching for config in home directories
continuous-integration/drone/push Build is failing Details

Signed-off-by: kolaente <k@knt.li>
This commit is contained in:
kolaente 2020-04-02 21:13:42 +02:00
parent 11246b948f
commit 6d1018e647
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 4 additions and 5 deletions

View File

@ -254,12 +254,11 @@ func InitConfig() {
homeDir, err := os.UserHomeDir()
if err != nil {
log.Println(err.Error())
log.Println("Using defaults.")
return
log.Println("No home directory found, not using config from ~/.config/vikunja/. Error was: %s", err.Error())
} else {
viper.AddConfigPath(path.Join(homeDir, ".config", "vikunja"))
}
viper.AddConfigPath(path.Join(homeDir, ".config", "vikunja"))
viper.AddConfigPath(".")
viper.SetConfigName("config")
err = viper.ReadInConfig()
@ -269,7 +268,7 @@ func InitConfig() {
return
}
log.Println("Found config file:", viper.ConfigFileUsed())
log.Println("Using config file:", viper.ConfigFileUsed())
}
func random(length int) (string, error) {