From 69df9b8aa6e8453810b77551c102b2333a8d5b14 Mon Sep 17 00:00:00 2001 From: Abdelrahman Ahmed <16365652+abahmed@users.noreply.github.com> Date: Mon, 19 Jun 2023 13:29:14 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Support=20disabling=20startup=20?= =?UTF-8?q?message=20for=20notifications=20channels=20(#233)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + config/config.go | 4 ++++ main.go | 6 ++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 93aa357b..c49e4225 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,7 @@ kubectl apply -f https://raw.githubusercontent.com/abahmed/kwatch/v0.8.3/deploy/ |:------------------------------|:------------------------------------------- | | `app.proxyURL` | used in outgoing http(s) requests except Kubernetes requests to cluster optionally | | `app.clusterName` | used in notifications to indicate which cluster has issue | +| `app.disableStartupMessage` | If set to true, welcome message will not be sent to notification channels | ### Upgrader diff --git a/config/config.go b/config/config.go index 99185942..97b6972a 100644 --- a/config/config.go +++ b/config/config.go @@ -58,6 +58,10 @@ type App struct { // ClusterName to used in notifications to indicate which cluster has // issue ClusterName string `yaml:"clusterName"` + + // DisableUpdateCheck if set to true, welcome message will not be + // sent to configured notification channels + DisableStartupMessage bool `yaml:"disableStartupMessage"` } // Upgrader confing struct diff --git a/main.go b/main.go index 4fc32b84..c962b506 100644 --- a/main.go +++ b/main.go @@ -28,8 +28,10 @@ func main() { alertManager := alertmanager.AlertManager{} alertManager.Init(config.Alert, &config.App) - // send notification to providers - alertManager.Notify(fmt.Sprintf(constant.WelcomeMsg, version.Short())) + if !config.App.DisableStartupMessage { + // send notification to providers + alertManager.Notify(fmt.Sprintf(constant.WelcomeMsg, version.Short())) + } // check and notify if newer versions are available upgrader := upgrader.NewUpgrader(&config.Upgrader, &alertManager)