[feature] Basic config validation (#562)

* add optional config validation

* clarify that host and protocol are required

* add validation for host and protocol

* pass prerunArgs as a struct (validate by default)
This commit is contained in:
tobi 2022-05-16 14:13:19 +02:00 committed by GitHub
commit b915a41811
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 180 additions and 15 deletions

View file

@ -35,7 +35,7 @@ func debugCommands() *cobra.Command {
Use: "config",
Short: "print the collated config (derived from env, flag, and config file) to stdout",
PreRunE: func(cmd *cobra.Command, args []string) error {
return preRun(cmd)
return preRun(preRunArgs{cmd: cmd, skipValidation: true}) // don't do validation for debugging config
},
RunE: func(cmd *cobra.Command, args []string) error {
return run(cmd.Context(), configaction.Config)