Start Core Hub FastAPI replacement foundation

This commit is contained in:
2026-06-27 11:41:26 +02:00
parent 75963233b6
commit 1e87adbcbb
37 changed files with 3292 additions and 30 deletions

35
src/core_hub/app.py Normal file
View File

@@ -0,0 +1,35 @@
from fastapi import FastAPI
from core_hub import __version__
from core_hub.api.v2 import router as api_v2_router
from core_hub.config import get_settings
from core_hub.schemas import HealthResponse, ReadinessResponse
def create_app() -> FastAPI:
settings = get_settings()
app = FastAPI(
title="Core Hub API",
version=__version__,
description="Third-generation production interaction framework API.",
)
@app.get("/healthz", response_model=HealthResponse, tags=["system"])
def healthz() -> HealthResponse:
return HealthResponse(service="core-hub", status="ok", version=__version__)
@app.get("/readyz", response_model=ReadinessResponse, tags=["system"])
def readyz() -> ReadinessResponse:
checks = {
"configuration": "ok",
"database_url": "configured" if settings.database_url else "missing",
"api_auth": "configured" if settings.auth_configured else "not_configured",
}
status = "ok" if checks["database_url"] == "configured" else "degraded"
return ReadinessResponse(service="core-hub", status=status, checks=checks)
app.include_router(api_v2_router)
return app
app = create_app()