Fix minor bugs in init command

This commit is contained in:
Behrang Noruzi Niya 2017-05-14 12:52:17 +04:30
parent 90687e7bfc
commit c20ba6375d
2 changed files with 6 additions and 6 deletions

View file

@ -197,13 +197,13 @@ func initConfig() {
// Find home directory. // Find home directory.
home, err := homedir.Dir() home, err := homedir.Dir()
if err != nil { if err != nil {
fmt.Println(home) fmt.Println(err)
os.Exit(1) os.Exit(1)
} }
// Search config in home directory with name ".cobra" (without extension). // Search config in home directory with name ".{{ .appName }}" (without extension).
viper.AddConfigPath(home) viper.AddConfigPath(home)
viper.SetConfigName(".cobra") viper.SetConfigName(".{{ .appName }}")
} }
viper.AutomaticEnv() // read in environment variables that match viper.AutomaticEnv() // read in environment variables that match

View file

@ -70,13 +70,13 @@ func initConfig() {
// Find home directory. // Find home directory.
home, err := homedir.Dir() home, err := homedir.Dir()
if err != nil { if err != nil {
fmt.Println(home) fmt.Println(err)
os.Exit(1) os.Exit(1)
} }
// Search config in home directory with name ".cobra" (without extension). // Search config in home directory with name ".testproject" (without extension).
viper.AddConfigPath(home) viper.AddConfigPath(home)
viper.SetConfigName(".cobra") viper.SetConfigName(".testproject")
} }
viper.AutomaticEnv() // read in environment variables that match viper.AutomaticEnv() // read in environment variables that match