Fix searching for config in home directories
Signed-off-by: kolaente <k@knt.li>
This commit is contained in:
parent
11246b948f
commit
6d1018e647
1 changed files with 4 additions and 5 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue