feat: add app factory with health endpoint and test infrastructure
This commit is contained in:
parent
fd8c8cbf39
commit
6a8b41cd38
3 changed files with 58 additions and 0 deletions
23
src/fastapi_oidc_op/app.py
Normal file
23
src/fastapi_oidc_op/app.py
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue