2023-03-09 21:05:31 +01:00

21 lines
458 B
Python

import os
from functools import lru_cache
from pydantic import BaseSettings, PostgresDsn
class Settings(BaseSettings):
asyncpg_url: PostgresDsn = PostgresDsn.build(
scheme="postgresql+asyncpg",
user=os.getenv("SQL_USER"),
password=os.getenv("POSTGRES_PASSWORD"),
host=os.getenv("SQL_HOST"),
port="5432",
path=f"/{os.getenv('SQL_DB') or ''}",
)
@lru_cache
def get_settings():
return Settings()