Fix searching for config in home directories

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
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

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