Skip to content

Commit

Permalink
fix home directory config not loading
Browse files Browse the repository at this point in the history
  • Loading branch information
timecode committed Nov 25, 2020
1 parent 08c51e5 commit 713fc39
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ func initConfig() {

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

Expand Down
1 change: 1 addition & 0 deletions cobra/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func initConfig() {

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

Expand Down
1 change: 1 addition & 0 deletions cobra/cmd/testdata/root.go.golden
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func initConfig() {

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

Expand Down
1 change: 1 addition & 0 deletions cobra/tpl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func initConfig() {
// Search config in home directory with name ".{{ .AppName }}" (without extension).
viper.AddConfigPath(home)
viper.SetConfigType("yaml")
viper.SetConfigName(".{{ .AppName }}")
}
Expand Down

0 comments on commit 713fc39

Please sign in to comment.