From a44f72a03027ba0835eb5a356db3170cbf847e20 Mon Sep 17 00:00:00 2001 From: Vegetto Date: Sat, 20 Feb 2021 16:42:48 +0100 Subject: [PATCH 1/3] Add DB_OPTIONS to enable DBs with SSL --- recipes/settings.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/settings.py b/recipes/settings.py index 3105c67f1b..1c56f5dfef 100644 --- a/recipes/settings.py +++ b/recipes/settings.py @@ -175,6 +175,7 @@ DATABASES = { 'default': { 'ENGINE': os.getenv('DB_ENGINE') if os.getenv('DB_ENGINE') else 'django.db.backends.sqlite3', + 'OPTIONS': os.getenv('DB_OPTIONS') if os.getenv('DB_OPTIONS') else [], 'HOST': os.getenv('POSTGRES_HOST'), 'PORT': os.getenv('POSTGRES_PORT'), 'USER': os.getenv('POSTGRES_USER'), From 5aa918f478379bb5c622149de3ed6fa46387e980 Mon Sep 17 00:00:00 2001 From: Vegetto Date: Sat, 20 Feb 2021 16:53:02 +0100 Subject: [PATCH 2/3] Document DB_OPTIONS env --- .env.template | 1 + 1 file changed, 1 insertion(+) diff --git a/.env.template b/.env.template index ecc639192e..1146dd9f07 100644 --- a/.env.template +++ b/.env.template @@ -13,6 +13,7 @@ TIMEZONE=Europe/Berlin # add only a database password if you want to run with the default postgres, otherwise change settings accordingly DB_ENGINE=django.db.backends.postgresql +# DB_OPTIONS= {} POSTGRES_HOST=db_recipes POSTGRES_PORT=5432 POSTGRES_USER=djangouser From 804adde964886160707c7b95cfe7dce940d777e3 Mon Sep 17 00:00:00 2001 From: Vegetto Date: Sat, 20 Feb 2021 16:54:42 +0100 Subject: [PATCH 3/3] Parse DB_OPTIONS dict --- recipes/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/settings.py b/recipes/settings.py index 1c56f5dfef..8f04a4d5c6 100644 --- a/recipes/settings.py +++ b/recipes/settings.py @@ -175,7 +175,7 @@ DATABASES = { 'default': { 'ENGINE': os.getenv('DB_ENGINE') if os.getenv('DB_ENGINE') else 'django.db.backends.sqlite3', - 'OPTIONS': os.getenv('DB_OPTIONS') if os.getenv('DB_OPTIONS') else [], + 'OPTIONS': ast.literal_eval(os.getenv('DB_OPTIONS')) if os.getenv('DB_OPTIONS') else {}, 'HOST': os.getenv('POSTGRES_HOST'), 'PORT': os.getenv('POSTGRES_PORT'), 'USER': os.getenv('POSTGRES_USER'),