Skip to content

Commit

Permalink
chore(db-con): use database password if present in env
Browse files Browse the repository at this point in the history
Use the DATABASE_PASSWORD environment variable if it exists and use  it
in database connection.

This is the way.

Refs RATY-129
  • Loading branch information
nicobav committed Oct 14, 2024
1 parent aa84492 commit 78bceaa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions open_city_profile/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
str,
"postgres://open_city_profile:open_city_profile@localhost/open_city_profile",
),
DATABASE_PASSWORD=(str, ""),
CACHE_URL=(str, "locmemcache://"),
EMAIL_URL=(str, "consolemail://"),
SENTRY_DSN=(str, ""),
Expand Down Expand Up @@ -136,6 +137,9 @@
# Ensure postgis engine
DATABASES["default"]["ENGINE"] = "django.contrib.gis.db.backends.postgis"

if env("DATABASE_PASSWORD"):
DATABASES["default"]["PASSWORD"] = env("DATABASE_PASSWORD")

CACHES = {"default": env.cache()}
vars().update(env.email_url()) # EMAIL_BACKEND etc.

Expand Down

0 comments on commit 78bceaa

Please sign in to comment.