Why: - first runnable slice of ADR-0012's resource-lifetime rules and ADR-0015's package layout: app-lifetime clients built once in the lifespan, released via explicit dependencies. Changes: - Settings split into per-domain nested settings (postgres/minio/ingestion/qdrant/app/logging); FastAPI app wired with /healthz, /readyz and a /v1 router; Postgres/MinIO/Qdrant adapters and SQLAlchemy models for tenants, API keys, source files, ingestion jobs/events.
17 lines
457 B
Python
17 lines
457 B
Python
from fastapi import FastAPI
|
|
|
|
from src.api.router import router as v1_router
|
|
from src.api.routers.health import router as health_router
|
|
from src.bootstrap.lifespan import create_lifespan
|
|
from src.config import Settings
|
|
|
|
|
|
def create_app(settings: Settings | None = None) -> FastAPI:
|
|
app = FastAPI(lifespan=create_lifespan(settings))
|
|
app.include_router(health_router)
|
|
app.include_router(v1_router, prefix="/v1")
|
|
return app
|
|
|
|
|
|
app = create_app()
|