Skip to content

Commit

Permalink
feat: add POSTGRES_PORT to get_default_postgres_url (#181)
Browse files Browse the repository at this point in the history
Update utils.py
  • Loading branch information
puehringer authored Feb 16, 2024
1 parent 953c74b commit 6f315ba
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions visyn_core/settings/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ def get_default_postgres_url(
password: str = "admin",
host: str | None = os.getenv("POSTGRES_HOSTNAME"),
host_fallback: str = "localhost",
port: int = 5432,
port: int | str | None = os.getenv("POSTGRES_PORT"),
port_fallback: int | str = 5432,
database: str = "db",
) -> str:
"""
Returns a default postgres url, including the default values for `driver`, `user`, `password`, `host`, `port` and `database`.
"""
return f"{driver}://{user}:{password}@{host or host_fallback}:{port}/{database}"
return f"{driver}://{user}:{password}@{host or host_fallback}:{port or port_fallback}/{database}"

0 comments on commit 6f315ba

Please sign in to comment.