mirror of
https://github.com/spf13/cobra
synced 2024-12-28 07:17:06 +00:00
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:
parent
4590150168
commit
9a432671fd
4 changed files with 4 additions and 0 deletions
|
@ -246,6 +246,7 @@ func initConfig() {
|
|||
|
||||
// Search config in home directory with name ".cobra" (without extension).
|
||||
viper.AddConfigPath(home)
|
||||
viper.SetConfigType("yaml")
|
||||
viper.SetConfigName(".cobra")
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ func initConfig() {
|
|||
|
||||
// Search config in home directory with name ".cobra" (without extension).
|
||||
viper.AddConfigPath(home)
|
||||
viper.SetConfigType("yaml")
|
||||
viper.SetConfigName(".cobra")
|
||||
}
|
||||
|
||||
|
|
1
cobra/cmd/testdata/root.go.golden
vendored
1
cobra/cmd/testdata/root.go.golden
vendored
|
@ -73,6 +73,7 @@ func initConfig() {
|
|||
|
||||
// Search config in home directory with name ".testproject" (without extension).
|
||||
viper.AddConfigPath(home)
|
||||
viper.SetConfigType("yaml")
|
||||
viper.SetConfigName(".testproject")
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,7 @@ func initConfig() {
|
|||
|
||||
// Search config in home directory with name ".{{ .AppName }}" (without extension).
|
||||
viper.AddConfigPath(home)
|
||||
viper.SetConfigType("yaml")
|
||||
viper.SetConfigName(".{{ .AppName }}")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue