Skip to content

Commit

Permalink
Print 'Using config file' only for generate sub-command
Browse files Browse the repository at this point in the history
Signed-off-by: Dinesh <[email protected]>
  • Loading branch information
dineshba committed Dec 13, 2019
1 parent c41d9a7 commit c9a5306
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var generateCmd = &cobra.Command{
os.Exit(1)
}

fmt.Println("Using config file:", cfgFile)
kubetmuxpCfg, err := kubetmuxp.NewConfig(cfgFile, fs, kubeCfg)
if err != nil {
fmt.Println(err)
Expand Down
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func initConfig() {

viper.AutomaticEnv()

if err := viper.ReadInConfig(); err == nil {
fmt.Println("Using config file:", viper.ConfigFileUsed())
if err := viper.ReadInConfig(); err != nil {
_, _ = fmt.Fprintln(os.Stderr, fmt.Sprintf("error reading config file %s: %v", viper.ConfigFileUsed(), err))
}
}

0 comments on commit c9a5306

Please sign in to comment.