INNER CODE UNIT · Python
lifespan
KatrielMoses/voidaccess · api/main.py:73
async def lifespan(app: FastAPI):
# --- Startup ---
logger.info("VoidAccess API started")
if JWT_SECRET is None:
raise RuntimeError(
"JWT_SECRET is not set. Set JWT_SECRET in your .env file. "
"Generate a secure secret with: python -c \"import secrets; print(secrets.token_hex(32))\""
)
# Run Alembic migrations (idempotent — safe to call on every boot)
_run_migrations()
_check_db_connectivity()
# Pre-warm Playwright browser (avoids cold start on first JS page)
if PLAYWRIGHT_ENABLED:
try: