Set the defaults BEFORE considering a --config CLI argument

This commit is contained in:
DLDInternet 2016-09-27 19:45:23 -04:00
parent 9c28e4bbd7
commit a7a96310e0

View file

@ -57,12 +57,12 @@ 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
// If a config file is found, read it in.