From 70c9485d0f46619ee3e122b88aeee6bc4c924e38 Mon Sep 17 00:00:00 2001 From: Artem Litvinov Date: Fri, 29 Sep 2023 16:27:03 +0100 Subject: [PATCH] fix: dsn password --- src/fastapi_app/lib/app/split_settings/postgres.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fastapi_app/lib/app/split_settings/postgres.py b/src/fastapi_app/lib/app/split_settings/postgres.py index 6aba752..7ea95ec 100644 --- a/src/fastapi_app/lib/app/split_settings/postgres.py +++ b/src/fastapi_app/lib/app/split_settings/postgres.py @@ -27,7 +27,8 @@ class DBSettings(pydantic_settings.BaseSettings): @property def dsn(self) -> str: - return f"{self.protocol}://{self.user}:{self.password}@{self.host}:{self.port}" + password = self.password.get_secret_value() if isinstance(self.password, pydantic.SecretStr) else self.password + return f"{self.protocol}://{self.user}:{password}@{self.host}:{self.port}" @property def dsn_as_safe_url(self) -> str: