Add immutable revisions, PGVN editor, asset replacement, merge and rebase workflows, authenticated media delivery and reachability GC. Harden the script interpreter, pin unrpyc and remove tracked build metadata. Include current compatibility checks, Naninovel import and regression tests.
32 lines
929 B
Python
32 lines
929 B
Python
import logging
|
|
from contextlib import asynccontextmanager
|
|
|
|
from fastapi import FastAPI
|
|
|
|
from app.bootstrap import bootstrap
|
|
from app.config import get_settings
|
|
from app.db import SessionLocal
|
|
from app.routers import auth, games, i18n, media, metadata, mods, roles, users, versions
|
|
|
|
logging.basicConfig(level=logging.INFO)
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(_: FastAPI):
|
|
if get_settings().secret_key == "change-me":
|
|
logging.getLogger(__name__).warning("SECRET_KEY is the default value — set it in .env")
|
|
async with SessionLocal() as db:
|
|
await bootstrap(db)
|
|
yield
|
|
|
|
|
|
app = FastAPI(title="pgames-manager", lifespan=lifespan, docs_url="/api/docs",
|
|
openapi_url="/api/openapi.json")
|
|
for r in (auth, users, roles, games, versions, i18n, metadata, media, mods):
|
|
app.include_router(r.router)
|
|
|
|
|
|
@app.get("/api/health")
|
|
async def health() -> dict[str, str]:
|
|
return {"status": "ok"}
|