You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As we gain support for additional signers, that may or may not be enabled, it obviously doesn't work to validate the config for something that isn't configured. So validation must be configurable, preferably on the "signers.{name}.enabled" key. I suggest something like this:
func ValidateBySection(config *Config, cfgfile string) error {
var configsections = make(map[string]interface{}, 5)
validate := validator.New()
log.Printf(`
*** Config validation: Note that sections that do not have an 'enabled=true' key
*** are not validated, but may still be used.`)
configsections["signers.desec"] = config.Signers.DeSEC
configsections["signers.foobar"] = config.Signers.Foobar
for k, data := range configsections {
if viper.GetBool(fmt.Sprintf("%s.enabled", k)) {
log.Printf("Validating config for %s section", k)
if err := validate.Struct(data); err != nil {
log.Fatalf("Config %s, section %s: missing required attributes:\n%v\n", cfgfile, k, err)
}
} else {
log.Printf("Config %s, section %s: not enabled (requires %s.enabled=true), not validating its config.",
cfgfile, k, k)
}
}
e=return nil
}
The text was updated successfully, but these errors were encountered:
As we gain support for additional signers, that may or may not be enabled, it obviously doesn't work to validate the config for something that isn't configured. So validation must be configurable, preferably on the "signers.{name}.enabled" key. I suggest something like this:
The text was updated successfully, but these errors were encountered: