started log ingestion and analysis
This commit is contained in:
21
app/main.py
21
app/main.py
@@ -3,7 +3,15 @@ from fastapi.responses import FileResponse
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from pathlib import Path
|
||||
|
||||
from app.routers import network, alerts, query as query_router, actions as actions_router, emulated_session as emulated_session_router
|
||||
from app.routers import (
|
||||
actions as actions_router,
|
||||
alerts,
|
||||
emulated_session as emulated_session_router,
|
||||
logs as logs_router,
|
||||
network,
|
||||
query as query_router,
|
||||
)
|
||||
from app.services import log_ingest
|
||||
|
||||
app = FastAPI(title="P5G Marvis", version="1.0.0", docs_url="/api/docs")
|
||||
|
||||
@@ -18,6 +26,7 @@ app.include_router(network.router, prefix="/api")
|
||||
app.include_router(alerts.router, prefix="/api")
|
||||
app.include_router(query_router.router, prefix="/api")
|
||||
app.include_router(actions_router.router, prefix="/api")
|
||||
app.include_router(logs_router.router, prefix="/api")
|
||||
app.include_router(emulated_session_router.router, prefix="/api")
|
||||
|
||||
UI = Path(__file__).parent / "ui" / "index.html"
|
||||
@@ -51,6 +60,16 @@ async def actions_page():
|
||||
return FileResponse(str(ACTIONS_UI))
|
||||
|
||||
|
||||
@app.on_event("startup")
|
||||
async def _startup() -> None:
|
||||
await log_ingest.startup()
|
||||
|
||||
|
||||
@app.on_event("shutdown")
|
||||
async def _shutdown() -> None:
|
||||
await log_ingest.shutdown()
|
||||
|
||||
|
||||
# Catch-all: serve the SPA for any unmatched path (supports deep-linking)
|
||||
@app.get("/{full_path:path}")
|
||||
async def spa(full_path: str):
|
||||
|
||||
Reference in New Issue
Block a user