From e1dc5f85a0d6c35bcacc09052c85972d40555fe9 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Tue, 18 Jul 2023 10:20:55 +0200 Subject: [PATCH] cmd/thalos/main.go: Make telegram notifications optional --- cmd/thalos/main.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/cmd/thalos/main.go b/cmd/thalos/main.go index 40b7b73..afba59b 100644 --- a/cmd/thalos/main.go +++ b/cmd/thalos/main.go @@ -225,17 +225,20 @@ func main() { } // Init telegram notification service - telegram, err := telegram.New(conf.Telegram.Id) - if err != nil { - log.WithError(err).Fatal("Failed to initialize telegram") - return + if len(conf.Telegram.Id) > 0 { + + telegram, err := telegram.New(conf.Telegram.Id) + if err != nil { + log.WithError(err).Fatal("Failed to initialize telegram") + return + } + + telegram.AddReceivers(conf.Telegram.Channel) + + // Register services in notification manager + notify.UseServices(telegram) } - telegram.AddReceivers(conf.Telegram.Channel) - - // Register services in notification manager - notify.UseServices(telegram) - // Connect to redis rdb := redis.NewClient(&redis.Options{ Addr: conf.Redis.Addr,