From 608543eb25734f7e01a081d3df158badc7d90301 Mon Sep 17 00:00:00 2001 From: PGijsbers Date: Tue, 4 Feb 2025 16:41:18 +0100 Subject: [PATCH] Take into consideration the environment configuration --- server/config.py | 4 ++-- server/extensions.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/server/config.py b/server/config.py index 996e538a..d1c0ab09 100644 --- a/server/config.py +++ b/server/config.py @@ -8,8 +8,8 @@ class Config(object): """ Config object for flask app """ - - load_dotenv(".env") + environment = os.environ.get("environment", "") + load_dotenv(f".env{environment}") SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URI") # 'sqlite:///' + os.path.join(basedir, 'app.db') SQLALCHEMY_TRACK_MODIFICATIONS = False diff --git a/server/extensions.py b/server/extensions.py index 1ef41774..138431aa 100644 --- a/server/extensions.py +++ b/server/extensions.py @@ -21,7 +21,8 @@ Declares extension for Flask App, connects with already existing database """ # specifying engine according to existing db -load_dotenv(".env") +environment = os.environ.get("environment", "") +load_dotenv(f".env{environment}") if not strtobool(os.environ.get("TESTING", "True")):