fix home directory config not loading (#1282)

leverage `viper.SetConfigType("yaml")` to fix issue regarding home directory configuration failing to load.
This commit is contained in:
Rob Playford 2021-06-16 02:52:13 +01:00 committed by GitHub
parent 4590150168
commit 9a432671fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 0 deletions

View file

@ -246,6 +246,7 @@ func initConfig() {
// Search config in home directory with name ".cobra" (without extension). // Search config in home directory with name ".cobra" (without extension).
viper.AddConfigPath(home) viper.AddConfigPath(home)
viper.SetConfigType("yaml")
viper.SetConfigName(".cobra") viper.SetConfigName(".cobra")
} }

View file

@ -67,6 +67,7 @@ func initConfig() {
// Search config in home directory with name ".cobra" (without extension). // Search config in home directory with name ".cobra" (without extension).
viper.AddConfigPath(home) viper.AddConfigPath(home)
viper.SetConfigType("yaml")
viper.SetConfigName(".cobra") viper.SetConfigName(".cobra")
} }

View file

@ -73,6 +73,7 @@ func initConfig() {
// Search config in home directory with name ".testproject" (without extension). // Search config in home directory with name ".testproject" (without extension).
viper.AddConfigPath(home) viper.AddConfigPath(home)
viper.SetConfigType("yaml")
viper.SetConfigName(".testproject") viper.SetConfigName(".testproject")
} }

View file

@ -86,6 +86,7 @@ func initConfig() {
// Search config in home directory with name ".{{ .AppName }}" (without extension). // Search config in home directory with name ".{{ .AppName }}" (without extension).
viper.AddConfigPath(home) viper.AddConfigPath(home)
viper.SetConfigType("yaml")
viper.SetConfigName(".{{ .AppName }}") viper.SetConfigName(".{{ .AppName }}")
} }