FastAPI + PostgreSQL 16. KYC, issue sistemi, permission/group yönetimi, session yönetimi, API client auth (kışla kapısı), officials/persons CRUD. Migration 0001–0013 dahil.
15 lines
340 B
Python
15 lines
340 B
Python
import os
|
|
import psycopg_pool
|
|
from pathlib import Path
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv(Path(__file__).parent.parent / ".env")
|
|
|
|
DSN = os.environ["DATABASE_URL"]
|
|
|
|
pool = psycopg_pool.AsyncConnectionPool(DSN, min_size=2, max_size=10, open=False)
|
|
|
|
|
|
async def get_conn():
|
|
async with pool.connection() as conn:
|
|
yield conn
|