feat: add local admin authentication
This commit is contained in:
10
app/main.py
10
app/main.py
@@ -1,7 +1,9 @@
|
||||
from fastapi import FastAPI
|
||||
from starlette.middleware.sessions import SessionMiddleware
|
||||
|
||||
from app.config import Settings, get_settings
|
||||
from app.db.session import create_db_engine, create_session_factory, initialize_schema
|
||||
from app.web.routes import router as web_router
|
||||
|
||||
|
||||
def create_app(settings: Settings | None = None) -> FastAPI:
|
||||
@@ -18,6 +20,14 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
||||
app.state.db_engine = engine
|
||||
app.state.session_factory = create_session_factory(engine)
|
||||
|
||||
app.add_middleware(
|
||||
SessionMiddleware,
|
||||
secret_key=resolved.secret_key,
|
||||
same_site="lax",
|
||||
https_only=False,
|
||||
)
|
||||
app.include_router(web_router)
|
||||
|
||||
@app.get("/healthz")
|
||||
def healthz() -> dict[str, str]:
|
||||
return {"status": "ok"}
|
||||
|
||||
Reference in New Issue
Block a user