mirror of
https://github.com/CyberMind-FR/secubox-deb.git
synced 2026-07-29 11:12:29 +00:00
feat(api): Add /health endpoint to 53 modules
Auto-generated health check endpoints for sidebar status:
- Returns {status: "ok", module: "name"}
- Public endpoint (no auth required)
- Used by sidebar.js for LED status display
Added via scripts/add-health-endpoints.py
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
aeaa8d581c
commit
e2989322f4
|
|
@ -20,6 +20,16 @@ from secubox_core.config import get_config
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-admin", version="1.0.0", root_path="/api/v1/admin")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("admin")
|
||||
|
|
|
|||
|
|
@ -17,6 +17,16 @@ from pathlib import Path
|
|||
from typing import Dict, Any, List, Optional
|
||||
|
||||
app = FastAPI(title="secubox-auth", version="2.0.0", root_path="/api/v1/auth")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,16 @@ from secubox_core.config import get_config
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-avatar", version="1.0.0", root_path="/api/v1/avatar")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("avatar")
|
||||
|
|
|
|||
|
|
@ -18,6 +18,16 @@ from typing import List, Optional, Dict
|
|||
from datetime import datetime
|
||||
|
||||
app = FastAPI(title="secubox-cdn", version="1.1.0", root_path="/api/v1/cdn")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("cdn")
|
||||
|
|
|
|||
|
|
@ -33,6 +33,16 @@ CONTAINER_NAME = "domoticz"
|
|||
DEFAULT_PORT = 8080
|
||||
|
||||
app = FastAPI(title="secubox-domoticz", version="1.0.0", root_path="/api/v1/domoticz")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("domoticz")
|
||||
|
|
|
|||
|
|
@ -22,6 +22,16 @@ from pathlib import Path
|
|||
import httpx
|
||||
|
||||
app = FastAPI(title="secubox-dpi", version="2.0.0", root_path="/api/v1/dpi")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("dpi")
|
||||
|
|
|
|||
|
|
@ -30,6 +30,16 @@ from secubox_core.config import get_config
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-droplet", version="2.0.0", root_path="/api/v1/droplet")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("droplet")
|
||||
|
|
|
|||
|
|
@ -22,6 +22,16 @@ from secubox_core.config import get_config
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-glances", version="1.0.0", root_path="/api/v1/glances")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("glances")
|
||||
|
|
|
|||
|
|
@ -19,6 +19,16 @@ from secubox_core.auth import router as auth_router, require_jwt
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-gotosocial", version="1.0.0", root_path="/api/v1/gotosocial")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("gotosocial")
|
||||
|
|
|
|||
|
|
@ -37,6 +37,16 @@ from secubox_core.config import get_config
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-haproxy", version="2.0.0", root_path="/api/v1/haproxy")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("haproxy")
|
||||
|
|
|
|||
|
|
@ -18,6 +18,16 @@ from secubox_core.auth import router as auth_router, require_jwt
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-hexo", version="1.0.0", root_path="/api/v1/hexo")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("hexo")
|
||||
|
|
|
|||
|
|
@ -19,6 +19,16 @@ from secubox_core.auth import router as auth_router, require_jwt
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-homeassistant", version="1.0.0", root_path="/api/v1/homeassistant")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("homeassistant")
|
||||
|
|
|
|||
|
|
@ -15,6 +15,16 @@ import time
|
|||
from pathlib import Path
|
||||
|
||||
app = FastAPI(title="secubox-hub", version="1.7.0", root_path="/api/v1/hub")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
# Auth router already has prefix="/auth" in secubox_core.auth
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
|
|
|
|||
|
|
@ -17,6 +17,16 @@ from secubox_core.auth import router as auth_router, require_jwt
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-jellyfin", version="1.0.0", root_path="/api/v1/jellyfin")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("jellyfin")
|
||||
|
|
|
|||
|
|
@ -36,6 +36,16 @@ app = FastAPI(
|
|||
version="1.0.0",
|
||||
root_path="/api/v1/jitsi"
|
||||
)
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
if auth_router:
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,16 @@ from secubox_core.config import get_config
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-ksm", version="1.0.0", root_path="/api/v1/ksm")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("ksm")
|
||||
|
|
|
|||
|
|
@ -17,6 +17,16 @@ from secubox_core.auth import router as auth_router, require_jwt
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-lyrion", version="1.0.0", root_path="/api/v1/lyrion")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("lyrion")
|
||||
|
|
|
|||
|
|
@ -19,6 +19,16 @@ from secubox_core.config import get_config
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-mac-guard", version="1.0.0", root_path="/api/v1/mac-guard")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
|
||||
router = APIRouter()
|
||||
|
|
|
|||
|
|
@ -69,6 +69,16 @@ def _parse_mem(mem_str: str) -> int:
|
|||
return int(mem_str)
|
||||
|
||||
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
@app.get("/status")
|
||||
async def status():
|
||||
cfg = _cfg()
|
||||
|
|
|
|||
|
|
@ -16,6 +16,16 @@ from pathlib import Path
|
|||
from typing import Dict, Any, List, Optional
|
||||
|
||||
app = FastAPI(title="secubox-mediaflow", version="2.0.0", root_path="/api/v1/mediaflow")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
|
||||
|
|
|
|||
|
|
@ -231,6 +231,16 @@ def _publish_avahi_service(name: str, service_type: str, port: int):
|
|||
return False
|
||||
|
||||
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
@app.get("/status")
|
||||
async def status():
|
||||
"""Public status endpoint."""
|
||||
|
|
|
|||
|
|
@ -22,6 +22,16 @@ import re
|
|||
from collections import defaultdict
|
||||
|
||||
app = FastAPI(title="secubox-metabolizer", version="1.0.0", root_path="/api/v1/metabolizer")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("metabolizer")
|
||||
|
|
|
|||
|
|
@ -24,6 +24,16 @@ app = FastAPI(
|
|||
version="1.0.0",
|
||||
root_path="/api/v1/metacatalog"
|
||||
)
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("metacatalog")
|
||||
|
|
|
|||
|
|
@ -22,6 +22,16 @@ from typing import List, Optional, Dict
|
|||
from datetime import datetime
|
||||
|
||||
app = FastAPI(title="secubox-mirror", version="1.0.0", root_path="/api/v1/mirror")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("mirror")
|
||||
|
|
|
|||
|
|
@ -32,6 +32,16 @@ app = FastAPI(
|
|||
version="1.0.0",
|
||||
root_path="/api/v1/mqtt"
|
||||
)
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("mqtt")
|
||||
|
|
|
|||
|
|
@ -22,6 +22,16 @@ from secubox_core.config import get_config
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-nac", version="2.0.0", root_path="/api/v1/nac")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
|
||||
router = APIRouter()
|
||||
|
|
|
|||
|
|
@ -18,6 +18,16 @@ from secubox_core.config import get_config
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-netdata", version="2.0.0", root_path="/api/v1/netdata")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("netdata")
|
||||
|
|
|
|||
|
|
@ -23,6 +23,16 @@ app = FastAPI(
|
|||
version="1.0.0",
|
||||
root_path="/api/v1/netdiag"
|
||||
)
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("netdiag")
|
||||
|
|
|
|||
|
|
@ -19,6 +19,16 @@ from datetime import datetime
|
|||
|
||||
app = FastAPI(title="secubox-netmodes", version="1.0.0",
|
||||
root_path="/api/v1/netmodes")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
|
||||
router = APIRouter()
|
||||
|
|
|
|||
|
|
@ -19,6 +19,16 @@ from secubox_core.config import get_config
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-nettweak", version="1.0.0", root_path="/api/v1/nettweak")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("nettweak")
|
||||
|
|
|
|||
|
|
@ -17,6 +17,16 @@ from secubox_core.auth import router as auth_router, require_jwt
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-newsbin", version="1.0.0", root_path="/api/v1/newsbin")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("newsbin")
|
||||
|
|
|
|||
|
|
@ -17,6 +17,16 @@ from secubox_core.auth import router as auth_router, require_jwt
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-ollama", version="1.0.0", root_path="/api/v1/ollama")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("ollama")
|
||||
|
|
|
|||
|
|
@ -23,6 +23,16 @@ from secubox_core.auth import router as auth_router, require_jwt
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-peertube", version="1.0.0", root_path="/api/v1/peertube")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("peertube")
|
||||
|
|
|
|||
|
|
@ -18,6 +18,16 @@ from secubox_core.auth import router as auth_router, require_jwt
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-photoprism", version="1.0.0", root_path="/api/v1/photoprism")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("photoprism")
|
||||
|
|
|
|||
|
|
@ -25,6 +25,16 @@ from secubox_core.auth import router as auth_router, require_jwt
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-picobrew", version="1.0.0", root_path="/api/v1/picobrew")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("picobrew")
|
||||
|
|
|
|||
|
|
@ -33,6 +33,16 @@ from secubox_core.kiosk import (
|
|||
)
|
||||
|
||||
app = FastAPI(title="secubox-portal", version="2.1.0", root_path="/api/v1/portal")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
router = APIRouter()
|
||||
log = get_logger("portal")
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,16 @@ from pathlib import Path
|
|||
from typing import Optional
|
||||
|
||||
app = FastAPI(title="secubox-qos", version="1.1.0", root_path="/api/v1/qos")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
|
||||
router = APIRouter()
|
||||
|
|
|
|||
|
|
@ -22,6 +22,16 @@ import uuid
|
|||
import psutil
|
||||
|
||||
app = FastAPI(title="secubox-reporter", version="1.0.0", root_path="/api/v1/reporter")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("reporter")
|
||||
|
|
|
|||
|
|
@ -22,6 +22,16 @@ app = FastAPI(
|
|||
version="1.0.0",
|
||||
root_path="/api/v1/routes"
|
||||
)
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("routes")
|
||||
|
|
|
|||
|
|
@ -22,6 +22,16 @@ app = FastAPI(
|
|||
version="1.0.0",
|
||||
root_path="/api/v1/rtty"
|
||||
)
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("rtty")
|
||||
|
|
|
|||
|
|
@ -36,6 +36,16 @@ except ImportError:
|
|||
httpx = None
|
||||
|
||||
app = FastAPI(title="secubox-saas-relay", version="1.0.0", root_path="/api/v1/saas-relay")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("saas-relay")
|
||||
|
|
|
|||
|
|
@ -17,6 +17,16 @@ from datetime import datetime
|
|||
from typing import Optional
|
||||
|
||||
app = FastAPI(title="secubox-smtp-relay", version="1.0.0", root_path="/api/v1/smtp-relay")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("smtp-relay")
|
||||
|
|
|
|||
|
|
@ -19,6 +19,16 @@ from secubox_core.config import get_config
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-streamforge", version="2.0.0", root_path="/api/v1/streamforge")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("streamforge")
|
||||
|
|
|
|||
|
|
@ -13,6 +13,16 @@ from secubox_core.config import get_config
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-streamlit", version="1.0.0", root_path="/api/v1/streamlit")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("streamlit")
|
||||
|
|
|
|||
|
|
@ -25,6 +25,16 @@ from typing import Optional, List, Dict, Any
|
|||
import platform
|
||||
|
||||
app = FastAPI(title="secubox-system", version="1.2.0", root_path="/api/v1/system")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("system")
|
||||
|
|
|
|||
|
|
@ -23,6 +23,16 @@ from secubox_core.auth import router as auth_router, require_jwt
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-torrent", version="1.0.0", root_path="/api/v1/torrent")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("torrent")
|
||||
|
|
|
|||
|
|
@ -25,6 +25,16 @@ app = FastAPI(
|
|||
version="1.0.0",
|
||||
root_path="/api/v1/turn"
|
||||
)
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("turn")
|
||||
|
|
|
|||
|
|
@ -20,6 +20,16 @@ from secubox_core.auth import router as auth_router, require_jwt
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-voip", version="1.0.0", root_path="/api/v1/voip")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("voip")
|
||||
|
|
|
|||
|
|
@ -196,6 +196,16 @@ async def _download_blocklist(url: str, name: str) -> int:
|
|||
return 0
|
||||
|
||||
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
@app.get("/status")
|
||||
async def status():
|
||||
"""Public status endpoint."""
|
||||
|
|
|
|||
|
|
@ -224,6 +224,16 @@ def _check_nftables_available() -> bool:
|
|||
return False
|
||||
|
||||
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
@app.get("/status")
|
||||
async def status():
|
||||
"""Public status endpoint."""
|
||||
|
|
|
|||
|
|
@ -71,6 +71,16 @@ def _parse_mem(mem_str: str) -> int:
|
|||
return int(mem_str)
|
||||
|
||||
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
@app.get("/status")
|
||||
async def status():
|
||||
cfg = _cfg()
|
||||
|
|
|
|||
|
|
@ -19,6 +19,16 @@ from secubox_core.auth import router as auth_router, require_jwt
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-webradio", version="1.0.0", root_path="/api/v1/webradio")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("webradio")
|
||||
|
|
|
|||
|
|
@ -18,6 +18,16 @@ from secubox_core.auth import router as auth_router, require_jwt
|
|||
from secubox_core.logger import get_logger
|
||||
|
||||
app = FastAPI(title="secubox-zigbee", version="1.0.0", root_path="/api/v1/zigbee")
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": "deb"}
|
||||
|
||||
app.include_router(auth_router, prefix="/auth")
|
||||
router = APIRouter()
|
||||
log = get_logger("zigbee")
|
||||
|
|
|
|||
140
scripts/add-health-endpoints.py
Normal file
140
scripts/add-health-endpoints.py
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Add /health endpoint to all SecuBox module APIs.
|
||||
|
||||
Adds a simple health check endpoint that returns:
|
||||
- status: "ok" | "degraded" | "error"
|
||||
- module: module name
|
||||
- uptime: service uptime if available
|
||||
|
||||
Usage:
|
||||
python scripts/add-health-endpoints.py [--dry-run]
|
||||
"""
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
PACKAGES_DIR = Path(__file__).parent.parent / "packages"
|
||||
|
||||
# Health endpoint code to inject
|
||||
HEALTH_ENDPOINT = '''
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {"status": "ok", "module": MODULE_NAME}
|
||||
'''
|
||||
|
||||
# Alternative for modules without MODULE_NAME
|
||||
HEALTH_ENDPOINT_INLINE = '''
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
# Health Check Endpoint (public, no auth)
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Public health check endpoint for sidebar status."""
|
||||
return {{"status": "ok", "module": "{module}"}}
|
||||
'''
|
||||
|
||||
|
||||
def get_module_name(path: Path) -> str:
|
||||
"""Extract module name from path."""
|
||||
# packages/secubox-ai-gateway/api/main.py -> ai-gateway
|
||||
parts = path.parts
|
||||
for i, p in enumerate(parts):
|
||||
if p.startswith("secubox-"):
|
||||
return p[8:] # Remove 'secubox-' prefix
|
||||
return "unknown"
|
||||
|
||||
|
||||
def has_health_endpoint(content: str) -> bool:
|
||||
"""Check if file already has a /health endpoint."""
|
||||
return bool(re.search(r'@app\.(get|post)\s*\(\s*["\']/?health["\']', content, re.IGNORECASE))
|
||||
|
||||
|
||||
def find_injection_point(content: str) -> int:
|
||||
"""Find best place to inject health endpoint (after imports, before routes)."""
|
||||
# Try to find the first @app.get or @app.post
|
||||
match = re.search(r'^@app\.(get|post)', content, re.MULTILINE)
|
||||
if match:
|
||||
return match.start()
|
||||
|
||||
# Fallback: find 'app = FastAPI' and inject after
|
||||
match = re.search(r'app\s*=\s*FastAPI\([^)]*\)\s*\n', content)
|
||||
if match:
|
||||
return match.end()
|
||||
|
||||
return -1
|
||||
|
||||
|
||||
def add_health_endpoint(filepath: Path, dry_run: bool = False) -> bool:
|
||||
"""Add health endpoint to a module's main.py."""
|
||||
content = filepath.read_text()
|
||||
|
||||
if has_health_endpoint(content):
|
||||
return False # Already has health endpoint
|
||||
|
||||
module_name = get_module_name(filepath)
|
||||
|
||||
# Check if MODULE_NAME is defined
|
||||
if "MODULE_NAME" in content:
|
||||
endpoint_code = HEALTH_ENDPOINT
|
||||
else:
|
||||
endpoint_code = HEALTH_ENDPOINT_INLINE.format(module=module_name)
|
||||
|
||||
injection_point = find_injection_point(content)
|
||||
if injection_point == -1:
|
||||
print(f" SKIP: No injection point found in {filepath}")
|
||||
return False
|
||||
|
||||
# Inject the health endpoint
|
||||
new_content = content[:injection_point] + endpoint_code + "\n" + content[injection_point:]
|
||||
|
||||
if dry_run:
|
||||
print(f" DRY-RUN: Would add /health to {filepath.relative_to(PACKAGES_DIR)}")
|
||||
else:
|
||||
filepath.write_text(new_content)
|
||||
print(f" ADDED: /health to {filepath.relative_to(PACKAGES_DIR)}")
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
dry_run = "--dry-run" in sys.argv
|
||||
|
||||
if dry_run:
|
||||
print("DRY RUN MODE - No files will be modified\n")
|
||||
|
||||
# Find all main.py files in packages/*/api/
|
||||
api_files = list(PACKAGES_DIR.glob("secubox-*/api/main.py"))
|
||||
print(f"Found {len(api_files)} API modules\n")
|
||||
|
||||
added = 0
|
||||
skipped = 0
|
||||
errors = 0
|
||||
|
||||
for filepath in sorted(api_files):
|
||||
module = get_module_name(filepath)
|
||||
try:
|
||||
if add_health_endpoint(filepath, dry_run):
|
||||
added += 1
|
||||
else:
|
||||
content = filepath.read_text()
|
||||
if has_health_endpoint(content):
|
||||
print(f" EXISTS: /health already in {module}")
|
||||
skipped += 1
|
||||
except Exception as e:
|
||||
print(f" ERROR: {module}: {e}")
|
||||
errors += 1
|
||||
|
||||
print(f"\n{'DRY RUN ' if dry_run else ''}Summary:")
|
||||
print(f" Added: {added}")
|
||||
print(f" Skipped: {skipped}")
|
||||
print(f" Errors: {errors}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Reference in New Issue
Block a user