From 6f315bae45d97a628fc677208ff1e0f63265d64e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20P=C3=BChringer?= <51900829+puehringer@users.noreply.github.com> Date: Fri, 16 Feb 2024 08:52:14 +0100 Subject: [PATCH] feat: add POSTGRES_PORT to get_default_postgres_url (#181) Update utils.py --- visyn_core/settings/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/visyn_core/settings/utils.py b/visyn_core/settings/utils.py index dabd3e7b3..0968eac2f 100644 --- a/visyn_core/settings/utils.py +++ b/visyn_core/settings/utils.py @@ -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}"