fail fast if two notification queues or inputs are enabled

This commit is contained in:
Chris Lu
2018-12-06 00:37:59 -08:00
parent 63619f8b8e
commit ffa2827ab1
2 changed files with 30 additions and 8 deletions

View File

@@ -41,6 +41,17 @@ func runFilerReplicate(cmd *Command, args []string) bool {
var notificationInput sub.NotificationInput
enabledInput := ""
for _, input := range sub.NotificationInputs {
if config.GetBool("notification." + input.GetName() + ".enabled") {
if enabledInput == "" {
enabledInput = input.GetName()
} else {
glog.Fatalf("Notification input is enabled for both %s and %s", enabledInput, input.GetName())
}
}
}
for _, input := range sub.NotificationInputs {
if config.GetBool("notification." + input.GetName() + ".enabled") {
viperSub := config.Sub("notification." + input.GetName())