migrate to pydantic 2

This commit is contained in:
Jakub Miazek
2023-07-07 20:32:41 +02:00
parent d07fb04553
commit d05f2cdb2e
8 changed files with 17 additions and 23 deletions

View File

@@ -1,18 +1,12 @@
import os
from functools import lru_cache
from pydantic import BaseSettings, PostgresDsn
from pydantic import PostgresDsn
from pydantic_settings import BaseSettings
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 ''}",
)
asyncpg_url: PostgresDsn = os.getenv("SQL_URL")
@lru_cache