From 4c836d84649b32ab8c23cc56452a10a4dcc0a4ad Mon Sep 17 00:00:00 2001 From: Meng Sen Date: Wed, 13 Nov 2024 17:05:53 +0800 Subject: [PATCH] Support for reading environment variables Support for reading environment variables FRONTEND_HOST, PORTAL_NAME, PORTAL_NAME, REDIS_LOCATION POSTGRES_HOST, POSTGRES_PORT, POSTGRES_NAME, POSTGRES_USER, POSTGRES_PASSWORD --- deploy/docker/local_settings.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/deploy/docker/local_settings.py b/deploy/docker/local_settings.py index 7dbad9ad1..54cfd3e02 100644 --- a/deploy/docker/local_settings.py +++ b/deploy/docker/local_settings.py @@ -1,17 +1,16 @@ -FRONTEND_HOST = 'http://localhost' -PORTAL_NAME = 'MediaCMS' -SECRET_KEY = 'ma!s3^b-cw!f#7s6s0m3*jx77a@riw(7701**(r=ww%w!2+yk2' -POSTGRES_HOST = 'db' -REDIS_LOCATION = "redis://redis:6379/1" +FRONTEND_HOST = os.getenv('FRONTEND_HOST', 'http://localhost') +PORTAL_NAME = os.getenv('PORTAL_NAME', 'MediaCMS') +SECRET_KEY = os.getenv('SECRET_KEY', 'ma!s3^b-cw!f#7s6s0m3*jx77a@riw(7701**(r=ww%w!2+yk2') +REDIS_LOCATION = os.getenv('REDIS_LOCATION', 'redis://redis:6379/1') DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql", - "NAME": "mediacms", - "HOST": POSTGRES_HOST, - "PORT": "5432", - "USER": "mediacms", - "PASSWORD": "mediacms", + "NAME": os.getenv('POSTGRES_NAME', 'mediacms'), + "HOST": os.getenv('POSTGRES_HOST', 'db'), + "PORT": os.getenv('POSTGRES_PORT', '5432'), + "USER": os.getenv('POSTGRES_USER', 'mediacms'), + "PASSWORD": os.getenv('POSTGRES_PASSWORD', 'mediacms'), } } @@ -31,4 +30,4 @@ MP4HLS_COMMAND = "/home/mediacms.io/bento4/bin/mp4hls" -DEBUG = False +DEBUG = os.getenv('DEBUG', 'False') == 'True'