Skip to content
Myr

fix home directory config not loading (#1282)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

leverage `viper.SetConfigType("yaml")` to fix issue regarding home directory configuration failing to load.

authored by Rob Playford · committed by GitHub · parent 4590150 · Browse files · 4 files+4 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+4 added−0 removed

  • other:+4 added−0 removed

4 files+4 added−0 removed

modified:cobra/cmd/testdata/root.go.golden+1 added
71 unmodified lines
72 cobra.CheckErr(err)7374 // Search config in home directory with name ".testproject" (without extension).75 viper.AddConfigPath(home)76 viper.SetConfigType("yaml")77 viper.SetConfigName(".testproject")78 }7980 viper.AutomaticEnv() // read in environment variables that match
6 unmodified lines
modified:cobra/cmd/root.go+1 added
65 unmodified lines
66 cobra.CheckErr(err)6768 // Search config in home directory with name ".cobra" (without extension).69 viper.AddConfigPath(home)70 viper.SetConfigType("yaml")71 viper.SetConfigName(".cobra")72 }7374 viper.AutomaticEnv()
5 unmodified lines
modified:cobra/tpl/main.go+1 added
84 unmodified lines
85 cobra.CheckErr(err)8687 // Search config in home directory with name ".{{ .AppName }}" (without extension).88 viper.AddConfigPath(home)89 viper.SetConfigType("yaml")90 viper.SetConfigName(".{{ .AppName }}")91 }9293 viper.AutomaticEnv() // read in environment variables that match
53 unmodified lines
modified:README.md+1 added
244 unmodified lines
245 cobra.CheckErr(err)246247 // Search config in home directory with name ".cobra" (without extension).248 viper.AddConfigPath(home)249 viper.SetConfigType("yaml")250 viper.SetConfigName(".cobra")251 }252253 viper.AutomaticEnv()
508 unmodified lines