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 0d040bf commit cdcf5cf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hauki/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def get_git_revision_hash() -> str:
SYSTEM_DATA_SOURCE_ID=(str, "hauki"),
LANGUAGES=(list, ["fi", "sv", "en"]),
DATABASE_URL=(str, "postgres:///hauki"),
DATABASE_PASSWORD=(str, ""),
TEST_DATABASE_URL=(str, ""),
TOKEN_AUTH_ACCEPTED_AUDIENCE=(str, ""),
TOKEN_AUTH_SHARED_SECRET=(str, ""),
Expand Down Expand Up @@ -100,6 +101,9 @@ def get_git_revision_hash() -> str:
if env("TEST_DATABASE_URL"):
DATABASES["default"]["TEST"] = env.db("TEST_DATABASE_URL")

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

DEFAULT_AUTO_FIELD = "django.db.models.AutoField"

AUTH_USER_MODEL = "users.User"
Expand Down

0 comments on commit cdcf5cf

Please sign in to comment.