Skip to content

Commit

Permalink
Fix --config flag description to reference correct default
Browse files Browse the repository at this point in the history
Signed-off-by: Justen Stall <39888103+justenstall@users.noreply.github.com>
  • Loading branch information
justenstall authored and daveshanley committed Oct 2, 2024
1 parent b07da40 commit 3555616
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func GetRootCommand() *cobra.Command {
return nil
},
}
rootCmd.PersistentFlags().StringVar(&configFile, "config", "", "config file (defaults to ./vacuum.yaml) ")
rootCmd.PersistentFlags().StringVar(&configFile, "config", "", "config file (defaults to ./vacuum.conf.yaml) ")
rootCmd.PersistentFlags().BoolP("time", "t", false, "Show how long vacuum took to run")
rootCmd.PersistentFlags().StringP("ruleset", "r", "", "Path to a spectral ruleset configuration")
rootCmd.PersistentFlags().StringP("functions", "f", "", "Path to custom functions")
Expand Down Expand Up @@ -114,6 +114,7 @@ func useConfigFile(cmd *cobra.Command) error {
}
return err
}

func useDefaultConfigFile() error {
viper.SetConfigName("vacuum.conf")
viper.SetConfigType("yaml")
Expand All @@ -137,8 +138,9 @@ func useEnvironmentConfiguration() {
// Environment variables can't have dashes in them
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
}

func useUserSuppliedConfigFile(configFilePath string) error {
viper.SetConfigFile(os.ExpandEnv(configFile))
viper.SetConfigFile(os.ExpandEnv(configFilePath))
return viper.ReadInConfig()
}

Expand Down

0 comments on commit 3555616

Please sign in to comment.