Skip to content

Commit

Permalink
Remove unused config file
Browse files Browse the repository at this point in the history
  • Loading branch information
ipmb committed Dec 11, 2020
1 parent 2811141 commit 3c66cfc
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ import (
"github.com/spf13/cobra"

"github.com/briandowns/spinner"
homedir "github.com/mitchellh/go-homedir"

"github.com/spf13/viper"
)

const ()
Expand All @@ -53,43 +50,6 @@ func Execute() {
}

func init() {
cobra.OnInitialize(initConfig)

// Here you will define your flags and configuration settings.
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.

rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.apppack.yaml)")

// Cobra also supports local flags, which will only run
// when this action is called directly.
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}

// initConfig reads in config file and ENV variables if set.
func initConfig() {
if cfgFile != "" {
// Use config file from the flag.
viper.SetConfigFile(cfgFile)
} else {
// Find home directory.
home, err := homedir.Dir()
if err != nil {
fmt.Println(err)
os.Exit(1)
}

// Search config in home directory with name ".apppack" (without extension).
viper.AddConfigPath(home)
viper.SetConfigName(".apppack")
}

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())
}
}

func checkErr(err error) {
Expand Down

0 comments on commit 3c66cfc

Please sign in to comment.