feat: add app factory with health endpoint and test infrastructure

This commit is contained in:
Johan Lundberg 2026-02-12 15:09:27 +01:00
parent fd8c8cbf39
commit 6a8b41cd38
No known key found for this signature in database
GPG key ID: A6C152738D03C7D1
3 changed files with 58 additions and 0 deletions

View file

@ -0,0 +1,23 @@
from fastapi import FastAPI
from fastapi_oidc_op.config import Settings
def create_app(settings: Settings | None = None) -> FastAPI:
if settings is None:
settings = Settings() # type: ignore[call-arg]
app = FastAPI(
title="FastAPI OIDC OP",
version="0.1.0",
docs_url="/docs" if settings.debug else None,
redoc_url=None,
)
app.state.settings = settings
@app.get("/health")
async def health() -> dict[str, str]:
return {"status": "ok"}
return app