Skip to content

Commit

Permalink
Output config file used when printing configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
msp301 committed May 18, 2024
1 parent 9d0b249 commit 84c2689
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ var configCmd = &cobra.Command{
Use: "config",
Short: "Get and set configuration options",
Run: func(cmd *cobra.Command, args []string) {
configFile := viper.ConfigFileUsed()
if configFile != "" {
fmt.Printf("Config file used: %s\n\n", viper.ConfigFileUsed())
}
jsonStr, _ := json.MarshalIndent(viper.AllSettings(), "", " ")
fmt.Println(string(jsonStr))
},
Expand Down

0 comments on commit 84c2689

Please sign in to comment.