set DB on sslmode=require on prod
This commit is contained in:
@@ -46,6 +46,8 @@ TELEGRAM_BOT_TOKEN = os.getenv('TG_BOT_TOKEN', '<tg token>')
|
||||
# Database settings
|
||||
# Only uncomment if default settings in base.py are not ok
|
||||
|
||||
DB_OPTIONS = {'sslmode': 'require'} if os.getenv('DB_SSL', False) == 'True' else {}
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
@@ -54,5 +56,6 @@ DATABASES = {
|
||||
'PASSWORD': os.getenv('DB_PASSWD', 'postgres'),
|
||||
'HOST': os.getenv('DB_HOST', 'localhost'),
|
||||
'PORT': os.getenv('DB_PORT', 5432),
|
||||
'OPTIONS': DB_OPTIONS,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ services:
|
||||
- DB_USER=sik
|
||||
- DB_HOST=managed-db.postgres.database.azure.com
|
||||
- DB_PORT=5432
|
||||
- DB_SSL=True
|
||||
- SECRET_KEY_FILE=/run/secrets/BACKEND_SECRET_KEY
|
||||
- TG_BOT_TOKEN_FILE=/run/secrets/BACKEND_TG_BOT_TOKEN
|
||||
- DB_PASSWD_FILE=/run/secrets/BACKEND_DB_PASSWD
|
||||
|
||||
Reference in New Issue
Block a user