From 8401a718bebe88e5aab43d4dd0d0278c989bba01 Mon Sep 17 00:00:00 2001
From: Tanner Prestegard <tanner.prestegard@ligo.org>
Date: Fri, 8 Feb 2019 15:56:48 -0600
Subject: [PATCH] Implement safeguards for no debug mode in
 production/playground

---
 config/settings/container/production.py | 4 ++++
 config/settings/vm/playground.py        | 5 ++++-
 config/settings/vm/production.py        | 6 ++++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/config/settings/container/production.py b/config/settings/container/production.py
index 9c390c4fa..cfd596824 100644
--- a/config/settings/container/production.py
+++ b/config/settings/container/production.py
@@ -7,3 +7,7 @@ DEBUG = False
 SEND_XMPP_ALERTS = True
 SEND_PHONE_ALERTS = True
 SEND_EMAIL_ALERTS = True
+
+# Safety check on debug mode for production
+if (DEBUG == True):
+    raise RuntimeError("Turn off debug mode for production")
diff --git a/config/settings/vm/playground.py b/config/settings/vm/playground.py
index b2cf7dc85..cc37692df 100644
--- a/config/settings/vm/playground.py
+++ b/config/settings/vm/playground.py
@@ -1,7 +1,6 @@
 # Settings for a playground GraceDB instance (for user testing) running
 # on a VM with Puppet provisioning. Starts with vm.py settings (which inherits
 # from base.py settings) and overrides or adds to them.
-import textwrap
 from .base import *
 
 CONFIG_NAME = "USER TESTING"
@@ -48,3 +47,7 @@ A nightly cron job removes events older than 14 days.</li>
 <b>112</b>.</li>
 </ul>
 """
+
+# Safety check on debug mode for playground
+if (DEBUG == True):
+    raise RuntimeError("Turn off debug mode for playground")
diff --git a/config/settings/vm/production.py b/config/settings/vm/production.py
index b30c98590..6558b94cc 100644
--- a/config/settings/vm/production.py
+++ b/config/settings/vm/production.py
@@ -3,6 +3,8 @@
 # settings) and overrides or adds to them.
 from .base import *
 
+DEBUG = False
+
 # LVAlert Overseer settings
 LVALERT_OVERSEER_INSTANCES = [
     {
@@ -15,3 +17,7 @@ LVALERT_OVERSEER_INSTANCES = [
 SEND_XMPP_ALERTS = True
 SEND_PHONE_ALERTS = True
 SEND_EMAIL_ALERTS = True
+
+# Safety check on debug mode for production
+if (DEBUG == True):
+    raise RuntimeError("Turn off debug mode for production")
-- 
GitLab