Use os.Getenv("HOME") instead of "$HOME" for windows compatibility (#337)

This commit is contained in:
Elliot Morrison-Reed 2017-04-20 15:35:06 +02:00 committed by Albert Nigmatzianov
parent b655df6ce8
commit a3cd8ab85a
2 changed files with 5 additions and 5 deletions

View File

@ -210,7 +210,7 @@ func initConfig() {
}
viper.SetConfigName(".{{ .appName }}") // name of config file (without extension)
viper.AddConfigPath("$HOME") // adding home directory as first search path
viper.AddConfigPath(os.Getenv("HOME")) // adding home directory as first search path
viper.AutomaticEnv() // read in environment variables that match
// If a config file is found, read it in.

View File

@ -62,7 +62,7 @@ func initConfig() {
}
viper.SetConfigName(".cobra") // name of config file (without extension)
viper.AddConfigPath("$HOME") // adding home directory as first search path
viper.AddConfigPath(os.Getenv("HOME")) // adding home directory as first search path
viper.AutomaticEnv() // read in environment variables that match
// If a config file is found, read it in.