6aa5e69ee4
nová stránka /portal/incidents s title CSBot Services Portal - Incidenty menu Provoz -> Incidenty aktivní incidenty a historie posledních 100 incidentů barevné stavy: open červeně, resolved zeleně karta Aktivní incidenty a seznam Poslední incidenty na přehledu realtime napojení přes existující operations-live.js a snapshot sekce Incidenty služby v detailu služby, posledních 20 incidentů DB helpery pro service_incidents migrace/indexy pro lokální prostředí, kde tabulka ještě neexistuje
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
from pathlib import Path
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.staticfiles import StaticFiles
|
|
from starlette.middleware.sessions import SessionMiddleware
|
|
|
|
from .config import read_env_value
|
|
from .routes import apps, audit, auth, backups, deployments, health, incidents, jobs, operations, workers
|
|
|
|
|
|
def create_app() -> FastAPI:
|
|
app = FastAPI(title="CSBot Services Portal")
|
|
session_secret = read_env_value("PORTAL_SESSION_SECRET", "") or "dev-only-appfactory-session-secret"
|
|
|
|
app.add_middleware(
|
|
SessionMiddleware,
|
|
secret_key=session_secret,
|
|
same_site="lax",
|
|
https_only=False,
|
|
)
|
|
|
|
static_dir = Path(__file__).parent / "static"
|
|
app.mount("/static", StaticFiles(directory=static_dir), name="static")
|
|
|
|
app.include_router(health.router)
|
|
app.include_router(auth.router)
|
|
app.include_router(apps.router)
|
|
app.include_router(backups.router)
|
|
app.include_router(deployments.router)
|
|
app.include_router(incidents.router)
|
|
app.include_router(operations.router)
|
|
app.include_router(jobs.router)
|
|
app.include_router(workers.router)
|
|
app.include_router(audit.router)
|
|
|
|
return app
|
|
|
|
|
|
app = create_app()
|