Jakub Miazek ee1d241d23 format
2023-04-10 21:42:13 +02:00

24 lines
486 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()
settings = get_settings()