From 17a36460dbcfff822510bce450389215c951f0c9 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 26 Nov 2024 16:40:59 +0000 Subject: [PATCH] backend: Read environment from environment Signed-off-by: Michael Tremer --- src/backend/base.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/backend/base.py b/src/backend/base.py index a3daa358..59275910 100644 --- a/src/backend/base.py +++ b/src/backend/base.py @@ -4,6 +4,7 @@ import configparser import io import location import logging +import os import ssl import tempfile import tornado.httpclient @@ -100,6 +101,13 @@ class Backend(object): """ Returns whether this is running in "production" or "testing" """ + # Fetch from the environment + try: + return os.environ["ENVIRONMENT"] + except KeyError: + pass + + # Fall back to the configuration return self.config.get("global", "environment") def setup_database(self): -- 2.47.3