Renamed validation funcs for alert notification
This commit is contained in:
@@ -41,12 +41,9 @@ func (cr *configReader) readConfig(path string) ([]*notificationsAsConfig, error
|
|||||||
}
|
}
|
||||||
|
|
||||||
cr.log.Debug("Validating alert notifications")
|
cr.log.Debug("Validating alert notifications")
|
||||||
err = validateDefaultUniqueness(notifications)
|
validateOrgIdAndSet(notifications)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = validateType(notifications)
|
err = validateNotifications(notifications)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -70,7 +67,7 @@ func (cr *configReader) parseNotificationConfig(path string, file os.FileInfo) (
|
|||||||
return cfg.mapToNotificationFromConfig(), nil
|
return cfg.mapToNotificationFromConfig(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateDefaultUniqueness(notifications []*notificationsAsConfig) error {
|
func validateOrgIdAndSet(notifications []*notificationsAsConfig) {
|
||||||
for i := range notifications {
|
for i := range notifications {
|
||||||
for _, notification := range notifications[i].Notifications {
|
for _, notification := range notifications[i].Notifications {
|
||||||
if notification.OrgId < 1 {
|
if notification.OrgId < 1 {
|
||||||
@@ -93,10 +90,9 @@ func validateDefaultUniqueness(notifications []*notificationsAsConfig) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateType(notifications []*notificationsAsConfig) error {
|
func validateNotifications(notifications []*notificationsAsConfig) error {
|
||||||
notifierTypes := alerting.GetNotifiers()
|
notifierTypes := alerting.GetNotifiers()
|
||||||
|
|
||||||
for i := range notifications {
|
for i := range notifications {
|
||||||
|
|||||||
Reference in New Issue
Block a user