Skip to content

Commit

Permalink
🔊 (config): Add debug log with config file info
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Apr 29, 2023
1 parent 7d63dd8 commit 0e43624
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func preRun(cmd *cobra.Command, args []string) error {
}
}

initLog(cmd)
if err := initConfig(); err != nil {
return err
}
Expand Down Expand Up @@ -147,11 +148,14 @@ func initConfig() error {
if err := viper.ReadInConfig(); err != nil {
if _, ok := err.(viper.ConfigFileNotFoundError); ok {
// Config file not found; ignore error
log.Debug("Could not find config file")
} else {
// Config file was found but another error was produced
return fmt.Errorf("Fatal error reading config file: %w", err)
}
}

log.WithField("path", viper.ConfigFileUsed()).Debug("Loaded config file")
return nil
}

Expand Down

0 comments on commit 0e43624

Please sign in to comment.