diff --git a/cobra/cmd/init.go b/cobra/cmd/init.go index 5532a081..b77c9864 100644 --- a/cobra/cmd/init.go +++ b/cobra/cmd/init.go @@ -210,8 +210,8 @@ func initConfig() { } viper.SetConfigName(".{{ .appName }}") // name of config file (without extension) - viper.AddConfigPath(os.Getenv("HOME")) // adding home directory as first search path - viper.AutomaticEnv() // read in environment variables that match + 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. if err := viper.ReadInConfig(); err == nil { diff --git a/cobra/cmd/root.go b/cobra/cmd/root.go index d7b08c22..32386ace 100644 --- a/cobra/cmd/root.go +++ b/cobra/cmd/root.go @@ -61,9 +61,9 @@ func initConfig() { viper.SetConfigFile(cfgFile) } - viper.SetConfigName(".cobra") // name of config file (without extension) - viper.AddConfigPath(os.Getenv("HOME")) // adding home directory as first search path - viper.AutomaticEnv() // read in environment variables that match + viper.SetConfigName(".cobra") // name of config file (without extension) + 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. if err := viper.ReadInConfig(); err == nil {