382825085f
Nové SQL migrace pro alert_rules a alert_events v migrations.py (line 165). Nová ruční DB vrstva v alerting.py (line 7). Nové stránky a akce v routes/alerting.py (line 288):Alert pravidla, detail, vytvoření, úprava, smazání povolit/zakázat pravidlo Alert eventy a detail eventu s payload_json odkazy z job_id na detail úlohy detail pravidla s posledními eventy admin-only editor .sh alert skriptů v /opt/appfactory/workspace/appfactory-tools/alerts audit eventy podle zadání Menu Provoz → Alerting v layout.py (line 23). Router je zaregistrovaný v main.py (line 8).
42 lines
1.3 KiB
Python
42 lines
1.3 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 alerting, apps, audit, auth, backups, deployments, health, incidents, jobs, operations, scheduled_scripts, 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(alerting.router)
|
|
app.include_router(operations.router)
|
|
app.include_router(scheduled_scripts.router)
|
|
app.include_router(jobs.router)
|
|
app.include_router(workers.router)
|
|
app.include_router(audit.router)
|
|
|
|
return app
|
|
|
|
|
|
app = create_app()
|