chore: release v1.0.0 — каркас FastAPI, ingress Grafana, интеграции, документация
Made-with: Cursor
This commit is contained in:
18
onguard24/vaultcheck.py
Normal file
18
onguard24/vaultcheck.py
Normal file
@ -0,0 +1,18 @@
|
||||
import httpx
|
||||
|
||||
|
||||
async def ping(addr: str, token: str) -> tuple[bool, str | None]:
|
||||
if not addr or not token:
|
||||
return False, "vault addr or token empty"
|
||||
base = addr.rstrip("/")
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=5.0, verify=True) as client:
|
||||
r = await client.get(
|
||||
f"{base}/v1/sys/health",
|
||||
headers={"X-Vault-Token": token},
|
||||
)
|
||||
except Exception as e:
|
||||
return False, str(e)
|
||||
if r.status_code in (200, 429, 503, 501):
|
||||
return True, None
|
||||
return False, f"http {r.status_code}"
|
||||
Reference in New Issue
Block a user