From c04e87e13f1cd9175a51feaa3d41a28ca50c496d Mon Sep 17 00:00:00 2001
From: Daniel Wysocki <daniel.m.wysocki@gmail.com>
Date: Wed, 22 Feb 2023 12:31:34 -0500
Subject: [PATCH] Disabling Mattermost alerts by default, enabling on specific
 tiers

---
 config/settings/base.py                 | 2 +-
 config/settings/container/playground.py | 3 +++
 config/settings/container/test.py       | 3 +++
 config/settings/vm/dev.py               | 1 +
 config/settings/vm/playground.py        | 3 +++
 config/settings/vm/production.py        | 1 +
 6 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/config/settings/base.py b/config/settings/base.py
index 0846b5f42..6ea727fcf 100644
--- a/config/settings/base.py
+++ b/config/settings/base.py
@@ -135,7 +135,7 @@ LOGOUT_REDIRECT_URL = 'home'
 SEND_XMPP_ALERTS = False
 SEND_PHONE_ALERTS = False
 SEND_EMAIL_ALERTS = False
-SEND_MATTERMOST_ALERTS = True
+SEND_MATTERMOST_ALERTS = False
 
 # igwn-alert group settings. the default development group is 'lvalert-dev'
 # for the container deployments, the variable will be overwriten by the 
diff --git a/config/settings/container/playground.py b/config/settings/container/playground.py
index 63646a45a..8bd24f01b 100644
--- a/config/settings/container/playground.py
+++ b/config/settings/container/playground.py
@@ -17,6 +17,9 @@ EMBB_MAIL_ADDRESS = 'gracedb@{fqdn}'.format(fqdn=SERVER_FQDN)
 #SEND_PHONE_ALERTS = False
 #SEND_EMAIL_ALERTS = False
 
+# Enable Mattermost alerts
+SEND_MATTERMOST_ALERTS = True
+
 # Add testserver to ALLOWED_HOSTS
 ALLOWED_HOSTS += ['testserver']
 
diff --git a/config/settings/container/test.py b/config/settings/container/test.py
index 0538b1db6..9a39aabdc 100644
--- a/config/settings/container/test.py
+++ b/config/settings/container/test.py
@@ -51,6 +51,9 @@ INTERNAL_IPS = [
 #SEND_PHONE_ALERTS = False
 #SEND_EMAIL_ALERTS = False
 
+# Enable Mattermost alerts
+SEND_MATTERMOST_ALERTS = True
+
 
 # Set up Sentry for error logging
 sentry_dsn = get_from_env('DJANGO_SENTRY_DSN', fail_if_not_found=False)
diff --git a/config/settings/vm/dev.py b/config/settings/vm/dev.py
index 6edf9ffec..10ff9f79a 100644
--- a/config/settings/vm/dev.py
+++ b/config/settings/vm/dev.py
@@ -10,6 +10,7 @@ CONFIG_NAME = "DEV"
 # Debug settings
 DEBUG = True
 SEND_XMPP_ALERTS=True
+SEND_MATTERMOST_ALERTS=True
 
 # Override EMBB email address
 # TP (8 Aug 2017): not sure why?
diff --git a/config/settings/vm/playground.py b/config/settings/vm/playground.py
index 644a9c76b..8daaeec58 100644
--- a/config/settings/vm/playground.py
+++ b/config/settings/vm/playground.py
@@ -16,6 +16,9 @@ EMBB_MAIL_ADDRESS = 'gracedb@{fqdn}'.format(fqdn=SERVER_FQDN)
 # Turn on XMPP alerts
 SEND_XMPP_ALERTS = True
 
+# Turn on Mattermost alerts
+SEND_MATTERMOST_ALERTS = True
+
 # Enforce that phone and email alerts are off
 SEND_PHONE_ALERTS = False
 SEND_EMAIL_ALERTS = False
diff --git a/config/settings/vm/production.py b/config/settings/vm/production.py
index e98cc30ad..9ba49c31b 100644
--- a/config/settings/vm/production.py
+++ b/config/settings/vm/production.py
@@ -19,6 +19,7 @@ LVALERT_OVERSEER_INSTANCES = [
 SEND_XMPP_ALERTS = True
 SEND_PHONE_ALERTS = True
 SEND_EMAIL_ALERTS = True
+SEND_MATTERMOST_ALERTS = True
 
 # Safety check on debug mode for production
 if (DEBUG == True):
-- 
GitLab