// initConfig reads in config file and ENV variables if set.
initConfig reads in config file and ENV variables if set.
// initConfig reads in config file and ENV variables if set .
func initConfig() {
	if rootFlags.cfgFile != "" {
		viper.SetConfigFile(rootFlags.cfgFile)
	} else {
		home, err := homedir.Dir()
		cobra.CheckErr(err)
		configDir := filepath.Join(home, ".imposter")
		if _, err := os.Stat(configDir); err == nil {
			viper.AddConfigPath(configDir)
			viper.SetConfigName("config")
		}
	}
	viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
	viper.SetEnvPrefix("IMPOSTER")
	viper.AutomaticEnv() 
	if err := viper.ReadInConfig(); err == nil {
		logrus.Tracef("using CLI config file: %v", viper.ConfigFileUsed())
	}
}
func initConfig ( ) { if rootFlags . cfgFile != " " { viper . SetConfigFile ( rootFlags . cfgFile ) } else { home , err := homedir . Dir ( ) cobra . CheckErr ( err ) configDir := filepath . Join ( home , " " ) if _ , err := os . Stat ( configDir ) ; err == nil { viper . AddConfigPath ( configDir ) viper . SetConfigName ( " " ) } } viper . SetEnvKeyReplacer ( strings . NewReplacer ( " " , " " ) ) viper . SetEnvPrefix ( " " ) viper . AutomaticEnv ( ) if err := viper . ReadInConfig ( ) ; err == nil { logrus . Tracef ( " " , viper . ConfigFileUsed ( ) ) } }
initConfig reads in config file and ENV variables if set.
initConfig reads in config file and ENV variables if set .
// Search files in config directory with name "config" (without extension). // read in environment variables that match // If a config file is found, read it in.