mirror of
https://github.com/spf13/cobra
synced 2024-11-24 22:57:12 +00:00
Generated apps will need to inherit this fix
This commit is contained in:
parent
78ca2b3bdd
commit
59e2709e24
1 changed files with 4 additions and 4 deletions
|
@ -205,12 +205,12 @@ func init() {
|
|||
{{ if .viper }}
|
||||
// initConfig reads in config file and ENV variables if set.
|
||||
func initConfig() {
|
||||
viper.SetConfigName(".{{ .appName }}") // name of config file (without extension)
|
||||
viper.AddConfigPath("$HOME") // adding home directory as first search path
|
||||
if cfgFile != "" { // enable ability to specify config file via flag
|
||||
viper.SetConfigFile(cfgFile)
|
||||
}
|
||||
|
||||
viper.SetConfigName(".{{ .appName }}") // name of config file (without extension)
|
||||
viper.AddConfigPath("$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.
|
||||
|
|
Loading…
Reference in a new issue