service_man/api/infrastructure/persistence/db_setings.py

21 lines
404 B
Python

from dataclasses import dataclass
@dataclass(frozen=True)
class DBSettings:
pg_user: str
pg_pass: str
pg_host: str
pg_port: int
pg_db: str
@property
def db_url(self) -> str:
return "postgresql+asyncpg://{}:{}@{}:{}/{}".format(
self.pg_user,
self.pg_pass,
self.pg_host,
self.pg_port,
self.pg_db,
)