mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2026-01-17 11:40:39 +03:00
migrate to pydantic 2
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user