Better validation of all config file fields (#6090)

Add Validate() to serverConfig to call it at server
startup and in Admin SetConfig handler to minimize
errors scenario after server restart.
This commit is contained in:
Anis Elleuch
2018-07-18 20:22:29 +02:00
committed by kannappanr
parent 758a80e39b
commit e8a008f5b5
14 changed files with 375 additions and 54 deletions

View File

@@ -43,6 +43,17 @@ type AMQPArgs struct {
AutoDeleted bool `json:"autoDeleted"`
}
// Validate AMQP arguments
func (a *AMQPArgs) Validate() error {
if !a.Enable {
return nil
}
if _, err := amqp.ParseURI(a.URL.String()); err != nil {
return err
}
return nil
}
// AMQPTarget - AMQP target
type AMQPTarget struct {
id event.TargetID