equal
deleted
inserted
replaced
181 // Read in environment variables that match, with a prefix |
181 // Read in environment variables that match, with a prefix |
182 viper.SetEnvPrefix(AppName) |
182 viper.SetEnvPrefix(AppName) |
183 viper.AutomaticEnv() |
183 viper.AutomaticEnv() |
184 |
184 |
185 // If a config file is found, read it in. |
185 // If a config file is found, read it in. |
186 if err := viper.ReadInConfig(); viper.GetBool("verbose") && err == nil { |
186 err := viper.ReadInConfig() |
|
187 if err != nil { |
|
188 if cfgFile != "" { |
|
189 errPrint("Error: cannot read configuration file '%s'", cfgFile) |
|
190 os.Exit(-1) |
|
191 } |
|
192 } else if viper.GetBool("verbose") { |
187 errPrint("Using config file: %s", viper.ConfigFileUsed()) |
193 errPrint("Using config file: %s", viper.ConfigFileUsed()) |
188 } |
194 } |
189 } |
195 } |
190 |
196 |
191 // getOutputFormat return the requested output format, defaulting to "plain". |
197 // getOutputFormat return the requested output format, defaulting to "plain". |