feat: notify config, refactor config load.

This commit is contained in:
tx7do
2023-10-26 16:46:14 +08:00
parent 6d18bc0ffe
commit e7883775ed
24 changed files with 1907 additions and 1177 deletions

View File

@@ -289,6 +289,35 @@ func (m *Bootstrap) validate(all bool) error {
}
}
if all {
switch v := interface{}(m.GetNotify()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, BootstrapValidationError{
field: "Notify",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, BootstrapValidationError{
field: "Notify",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetNotify()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return BootstrapValidationError{
field: "Notify",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 {
return BootstrapMultiError(errors)
}