From 0911196b1b80ab783cbb347428f2b3256340d054 Mon Sep 17 00:00:00 2001 From: Jake Watkins Date: Wed, 14 Aug 2024 13:15:50 +0100 Subject: [PATCH] Fix app.env that was causing 500 error on / Flask removed FLASK_ENV in v2.3.0 which was being checked on the root flask route. (Thanks gcox!) This commit fixes the environment varible for the seperate environments and fixes where the variable is being sourced. --- clouddeploy/sso-dashboard-dev.template.yaml | 2 +- clouddeploy/sso-dashboard-prod.template.yaml | 2 +- clouddeploy/sso-dashboard-staging.template.yaml | 2 +- dashboard/app.py | 2 +- dashboard/config.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/clouddeploy/sso-dashboard-dev.template.yaml b/clouddeploy/sso-dashboard-dev.template.yaml index 0f8b9d49..54185f5f 100644 --- a/clouddeploy/sso-dashboard-dev.template.yaml +++ b/clouddeploy/sso-dashboard-dev.template.yaml @@ -88,7 +88,7 @@ spec: - name: AWS_DEFAULT_REGION value: us-west-2 - name: ENVIRONMENT - value: Staging + value: development - name: MOZILLIANS_API_URL value: https://mozillians.org/api/v2/users/ - name: DASHBOARD_GUNICORN_WORKERS diff --git a/clouddeploy/sso-dashboard-prod.template.yaml b/clouddeploy/sso-dashboard-prod.template.yaml index 852024f3..f3054669 100644 --- a/clouddeploy/sso-dashboard-prod.template.yaml +++ b/clouddeploy/sso-dashboard-prod.template.yaml @@ -88,7 +88,7 @@ spec: - name: AWS_DEFAULT_REGION value: us-west-2 - name: ENVIRONMENT - value: Prod + value: production - name: MOZILLIANS_API_URL value: https://mozillians.org/api/v2/users/ - name: DASHBOARD_GUNICORN_WORKERS diff --git a/clouddeploy/sso-dashboard-staging.template.yaml b/clouddeploy/sso-dashboard-staging.template.yaml index 4cdee543..f3a387b5 100644 --- a/clouddeploy/sso-dashboard-staging.template.yaml +++ b/clouddeploy/sso-dashboard-staging.template.yaml @@ -88,7 +88,7 @@ spec: - name: AWS_DEFAULT_REGION value: us-west-2 - name: ENVIRONMENT - value: Prod + value: staging - name: MOZILLIANS_API_URL value: https://mozillians.org/api/v2/users/ - name: DASHBOARD_GUNICORN_WORKERS diff --git a/dashboard/app.py b/dashboard/app.py index f211e958..52732128 100644 --- a/dashboard/app.py +++ b/dashboard/app.py @@ -88,7 +88,7 @@ def favicon(): @app.route("/") def home(): - if app.env == "development": + if config.Config(app).environment == "local": return redirect("dashboard", code=302) url = request.url.replace("http://", "https://", 1) diff --git a/dashboard/config.py b/dashboard/config.py index 5d6d9b27..40362382 100644 --- a/dashboard/config.py +++ b/dashboard/config.py @@ -11,7 +11,7 @@ class Config(object): def __init__(self, app): self.app = app - self.environment = CONFIG("environment", default="development") + self.environment = CONFIG("environment", default="local") self.settings = self._init_env() def _init_env(self):