feat: dynamically configure database names based on ENVIRONMENT variable
All checks were successful
Deploy Beta (NATIVE) / deploy (push) Successful in 34s

This commit is contained in:
vickytechkey 2026-09-06 15:33:08 +05:30
parent 2e604f1c6f
commit cfe1175e6b
2 changed files with 7 additions and 3 deletions

View file

@ -81,6 +81,7 @@ jobs:
# ── 5. Configure environment variables ─────────────────────────
echo "DEBUG=0" > .env
echo "ENVIRONMENT=beta" >> .env
echo "DB_USER=vignesh" >> .env
echo "DB_PASSWORD=vtechnosoft@123A" >> .env
echo "DB_HOST=16.113.106.152" >> .env

View file

@ -105,17 +105,20 @@ if is_postgres_available():
'PORT': os.environ.get('DB_PORT', '5432'),
}
env_name = os.environ.get('ENVIRONMENT', 'prod')
db_suffix = f'_{env_name}'
DATABASES = {
'default': {
'NAME': 'sellerprofile',
'NAME': f'sellerprofile{db_suffix}',
**db_credentials
},
'customerprofile': {
'NAME': 'customerprofile',
'NAME': f'customerprofile{db_suffix}',
**db_credentials
},
'productprofile': {
'NAME': 'productprofile',
'NAME': f'productprofile{db_suffix}',
**db_credentials
}
}