cmd: Fix minor bugs in init command (#446)

This commit is contained in:
Behrang Noruzi Niya 2017-05-14 14:30:53 +04:30 committed by Albert Nigmatzianov
parent 90687e7bfc
commit a28055bed2
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