diff mbox series

[layerindex-web,3/3] Extend support for environmental variables in docker/settings.py

Message ID 20251121203350.55855-3-piotr@qbee.io
State New
Headers show
Series [layerindex-web,1/3] Add support for Development Containers | expand

Commit Message

Piotr Buliński Nov. 21, 2025, 8:33 p.m. UTC
This change will allow devcontainer (or any other way of deploying the
system) to provide values for BASE_DIR and EMAIL_BACKEND through
environmental varialbles.

Signed-off-by: Piotr Buliński <piotr@qbee.io>
---
 docker/settings.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/docker/settings.py b/docker/settings.py
index c202585..9a96e83 100644
--- a/docker/settings.py
+++ b/docker/settings.py
@@ -50,7 +50,7 @@  USE_I18N = True
 USE_L10N = True
 
 # Avoid specific paths
-BASE_DIR = os.path.dirname(__file__)
+BASE_DIR = os.getenv('BASE_DIR', os.path.dirname(__file__))
 
 # Absolute filesystem path to the directory that will hold user-uploaded files.
 # Example: "/home/media/media.lawrence.com/media/"
@@ -231,6 +231,9 @@  MESSAGE_TAGS = {
 
 # Registration settings
 ACCOUNT_ACTIVATION_DAYS = 2
+EMAIL_BACKEND = os.getenv(
+    "EMAIL_BACKEND", "django.core.mail.backends.smtp.EmailBackend"
+)
 EMAIL_HOST = os.getenv('EMAIL_HOST', 'layers.test')
 EMAIL_PORT = os.getenv('EMAIL_PORT', '25')
 EMAIL_USE_TLS = os.getenv('EMAIL_USE_TLS', False)