Buckets:

download
raw
2.19 kB
"""
Health Check Routes
Diese Endpoints wurden aus api/main.py migriert.
"""
import os
from datetime import datetime
from fastapi import APIRouter
from sqlalchemy import text
from database.models import SessionLocal
router = APIRouter(tags=["Health"])
@router.get("/health")
async def health_check():
"""
Health check endpoint für Docker und Monitoring
Prüft alle wichtigen Services
**Migriert von:** `api/main.py` (ursprünglich GET /health)
"""
import redis
health_status = {
"status": "healthy",
"version": "3.0.0",
"timestamp": datetime.utcnow().isoformat(),
"services": {},
}
# Check Database
try:
db = SessionLocal()
db.execute(text("SELECT 1"))
db.close()
health_status["services"]["database"] = {
"status": "ok",
"type": "postgresql",
}
except Exception as e:
health_status["services"]["database"] = {
"status": "error",
"error": str(e),
}
health_status["status"] = "degraded"
# Check Redis
try:
redis_client = redis.from_url(
os.getenv("REDIS_URL", "redis://localhost:6379/0"),
socket_connect_timeout=2,
)
redis_client.ping()
health_status["services"]["redis"] = {"status": "ok"}
except Exception as e:
health_status["services"]["redis"] = {
"status": "error",
"error": str(e),
}
health_status["status"] = "degraded"
# Check API selbst
health_status["services"]["api"] = {"status": "ok", "port": 8000}
return health_status
@router.get("/info")
async def api_info():
"""
API information
**Migriert von:** `api/main.py` (ursprünglich GET /info)
"""
return {
"name": "Zen-AI-Pentest API",
"version": "3.0.0",
"description": "Professional Pentesting Framework",
"endpoints": {
"scans": "/api/v1/scans",
"findings": "/api/v1/findings",
"tools": "/api/v1/tools",
"reports": "/api/v1/reports",
"schedules": "/api/v1/schedules",
},
}

Xet Storage Details

Size:
2.19 kB
·
Xet hash:
fdd16bad36bcf67c9f58dc191e2e6e9dbf7607924213a4bbdd2292522dfdbebf

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.