mirror of
https://github.com/spf13/cobra
synced 2025-05-05 12:57:22 +00:00
Merge 1a428baa9d
into b655df6ce8
This commit is contained in:
commit
83af8d167b
1 changed files with 4 additions and 3 deletions
|
@ -57,13 +57,14 @@ func init() {
|
|||
|
||||
// Read in config file and ENV variables if set.
|
||||
func initConfig() {
|
||||
viper.SetConfigName(".cobra") // 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(".cobra") // name of config file (without extension)
|
||||
viper.AddConfigPath("$HOME") // adding home directory as first search path
|
||||
viper.AutomaticEnv() // read in environment variables that match
|
||||
viper.AutomaticEnv() // read in environment variables that match
|
||||
|
||||
// If a config file is found, read it in.
|
||||
if err := viper.ReadInConfig(); err == nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue