Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix --config flag description to reference correct default #550

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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