Add Telegram Alerting (#102)

This commit is contained in:
Jonah
2021-03-31 01:38:34 +02:00
committed by GitHub
parent 4e5a86031f
commit 24da853820
10 changed files with 212 additions and 9 deletions

View File

@ -234,6 +234,7 @@ func validateAlertingConfig(config *Config) {
core.MessagebirdAlert,
core.PagerDutyAlert,
core.SlackAlert,
core.TelegramAlert,
core.TwilioAlert,
}
var validProviders, invalidProviders []core.AlertType
@ -292,6 +293,12 @@ func GetAlertingProviderByAlertType(config *Config, alertType core.AlertType) pr
return nil
}
return config.Alerting.Slack
case core.TelegramAlert:
if config.Alerting.Telegram == nil {
// Since we're returning an interface, we need to explicitly return nil, even if the provider itself is nil
return nil
}
return config.Alerting.Telegram
case core.TwilioAlert:
if config.Alerting.Twilio == nil {
// Since we're returning an interface, we need to explicitly return nil, even if the provider itself is nil