removed try/catch

This commit is contained in:
Michael Genson 2024-02-12 16:58:03 +00:00
parent a384e6716d
commit 8db08c21e5

View File

@ -45,28 +45,15 @@ class PostgresProvider(AbstractDBProvider, BaseSettings):
@property
def db_url(self) -> str:
host = f"{self.POSTGRES_SERVER}:{self.POSTGRES_PORT}"
try:
url = PostgresDsn.build(
scheme="postgresql",
username=self.POSTGRES_USER,
password=self.POSTGRES_PASSWORD,
host=host,
path=f"{self.POSTGRES_DB or ''}",
)
except ValueError as outer_error:
try:
# if the password contains special characters, it needs to be URL encoded
url = PostgresDsn.build(
return str(
PostgresDsn.build(
scheme="postgresql",
username=self.POSTGRES_USER,
password=urlparse.quote_plus(self.POSTGRES_PASSWORD),
host=host,
path=f"{self.POSTGRES_DB or ''}",
)
except Exception:
raise outer_error
return str(url)
)
@property
def db_url_public(self) -> str: