Refactor dev mode into a source repo script (remove dev subcommand from package).

This commit is contained in:
2025-12-05 18:36:13 +00:00
parent 0355c55fc0
commit 8609f2fe69
4 changed files with 157 additions and 129 deletions
+8 -9
View File
@@ -43,15 +43,6 @@ async def lifespan(app: FastAPI): # pragma: no cover - startup path
# Re-raise to fail fast
raise
# In dev mode, Vite serves assets directly; in production, mount static files
# This is deferred to lifespan because PASSKEY_DEVMODE is set after module import
if not frontend.is_dev_mode():
app.mount(
"/auth/assets/",
StaticFiles(directory=frontend.file("auth", "assets")),
name="assets",
)
yield
# (Optional) add shutdown cleanup here later
@@ -65,6 +56,14 @@ app.mount("/auth/api/admin/", admin.app)
app.mount("/auth/api/", api.app)
app.mount("/auth/ws/", ws.app)
# In dev mode (PASSKEY_DEVMODE=1), Vite serves assets directly; skip static files mount
if not frontend.is_dev_mode():
app.mount(
"/auth/assets/",
StaticFiles(directory=frontend.file("auth", "assets")),
name="assets",
)
@app.get("/auth/restricted/")
async def restricted_view():