Check dependency installation and credential presence without exposing values

This commit is contained in:
ModelHub XC Automation
2026-10-26 23:36:03 +08:00
parent 89099ae79d
commit 3cf0ca7420
4 changed files with 12 additions and 1 deletions

6
app.py
View File

@@ -3,8 +3,12 @@ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
import json
import os
metadata = {"name": "xc-cloud-build-probe", "version": "probe-20261026-01",
external_token = os.environ.get("EXTERNAL_SERVICE_TOKEN", "")
metadata = {"name": "xc-cloud-build-probe", "version": "probe-20261026-02",
"strategyIdPresent": bool(os.environ.get("STRATEGY_ID")),
"externalCredentialPresent": bool(external_token),
"externalCredentialLength": len(external_token),
"externalCredentialShape": "jwt-like" if external_token.count(".") == 2 else "opaque" if external_token else "empty",
"credentialEnvironmentNames": sorted(name for name in os.environ
if any(marker in name for marker in ("TOKEN", "AUTH", "CREDENTIAL", "SECRET", "API_KEY")))}
print(json.dumps(metadata), flush=True)