mirror of
https://github.com/hansjone/netx.git
synced 2026-10-10 18:10:45 +08:00
Harden auth scopes, SQL/WebCRT gates, and per-install JWT secrets.
Add capability RBAC, Alembic bootstrap, optional worker schedulers, and close public docs by default so lab installs stay usable without shared signing keys. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
cb8e0d23c5
commit
633a9d55bd
38 changed files with 1808 additions and 452 deletions
29
netx_api/integrations_router.py
Normal file
29
netx_api/integrations_router.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"""Thin integrations / health routes (liveness vs readiness)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy import text as sql_text
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from .db import get_db
|
||||
|
||||
router = APIRouter(tags=["health"])
|
||||
|
||||
|
||||
@router.get("/health/live", status_code=200)
|
||||
def health_live() -> dict[str, str]:
|
||||
"""Process liveness — no DB or upstream checks."""
|
||||
return {"status": "ok", "probe": "live"}
|
||||
|
||||
|
||||
@router.get("/health/ready", status_code=200)
|
||||
def health_ready(db: Session = Depends(get_db)) -> dict[str, Any]:
|
||||
"""Readiness — verifies database connectivity."""
|
||||
try:
|
||||
db.execute(sql_text("select 1"))
|
||||
return {"status": "ok", "probe": "ready", "db": "up"}
|
||||
except Exception as exc:
|
||||
return {"status": "down", "probe": "ready", "db": "down", "error": str(exc)[:240]}
|
||||
Loading…
Add table
Add a link
Reference in a new issue