From 7f94b164701abb7f3813bb9f08fac44db2e01006 Mon Sep 17 00:00:00 2001 From: gotjosh Date: Wed, 9 Nov 2022 18:26:06 +0000 Subject: [PATCH] Validate that either bot_token or http_configs.authorization must be present Signed-off-by: gotjosh --- config/notifiers.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/notifiers.go b/config/notifiers.go index bc1ea5bf..5c360b9b 100644 --- a/config/notifiers.go +++ b/config/notifiers.go @@ -197,6 +197,12 @@ func (c *WebexConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { return fmt.Errorf("missing room_id on webex_config") } + if c.BotToken == "" { + if c.HTTPConfig == nil || c.HTTPConfig.Authorization == nil { + return fmt.Errorf("missing one of webex_configs.http_config.authorization or bot_token") + } + } + return nil }