cmd/fstack/cmd/root.go
func initConfig() {
	if cfgFile != "" { // enable ability to specify config file via flag
		viper.SetConfigFile(cfgFile)
	}

	viper.SetConfigName(".fstack") // 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.
	if err := viper.ReadInConfig(); err == nil {
		fmt.Println("Using config file:", viper.ConfigFileUsed())
	}

	fs, err := fstack.OpenStack(stackFile)
	if err != nil {
		panic(err)
	}
	stack = fs
}
func initConfig() {
	if cfgFile != "" { // enable ability to specify config file via flag
		viper.SetConfigFile(cfgFile)
	}

	viper.SetConfigName(".fstack") // 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.
	if err := viper.ReadInConfig(); err == nil {
		fmt.Println("Using config file:", viper.ConfigFileUsed())
	}

	fs, err := fstack.OpenStack(stackFile)
	if err != nil {
		panic(err)
	}
	stack = fs
}
func initConfig ( ) { if cfgFile != " " { // enable ability to specify config file via flag viper . SetConfigFile ( cfgFile ) } viper . SetConfigName ( " " ) // name of config file (without extension) viper . AddConfigPath ( " " ) // adding home directory as first search path viper . AutomaticEnv ( ) // read in environment variables that match // If a config file is found, read it in. if err := viper . ReadInConfig ( ) ; err == nil { fmt . Println ( " " , viper . ConfigFileUsed ( ) ) } fs , err := fstack . OpenStack ( stackFile ) if err != nil { panic ( err ) } stack = fs }
// initConfig reads in config file and ENV variables if set.
initConfig reads in config file and ENV variables if set .