Make missing key file fail loudly instead of using dead key fallback
- Drop dead key literal from except block - Report 'no-key-file' as check status when key file missing/unreadable
This commit is contained in:
@@ -35,7 +35,7 @@ try:
|
|||||||
with open(LITELLM_KEY_FILE) as f:
|
with open(LITELLM_KEY_FILE) as f:
|
||||||
SYNTHETIC_API_KEY = f.read().strip()
|
SYNTHETIC_API_KEY = f.read().strip()
|
||||||
except:
|
except:
|
||||||
SYNTHETIC_API_KEY = "sk-U_ydi3B-wfGU-_xESkoU1Q"
|
SYNTHETIC_API_KEY = None # Fail loudly: report "no-key-file" in check
|
||||||
|
|
||||||
NOW = datetime.datetime.now()
|
NOW = datetime.datetime.now()
|
||||||
DATE_STR = NOW.strftime("%Y-%m-%d")
|
DATE_STR = NOW.strftime("%Y-%m-%d")
|
||||||
@@ -253,6 +253,10 @@ def collect():
|
|||||||
report["litellm"]["checks"].append({"name": "oidc-auth", "status": "pass" if auth_code in ("200","302") else "fail", "code": auth_code})
|
report["litellm"]["checks"].append({"name": "oidc-auth", "status": "pass" if auth_code in ("200","302") else "fail", "code": auth_code})
|
||||||
|
|
||||||
# Check 5: Synthetic API call through LiteLLM
|
# Check 5: Synthetic API call through LiteLLM
|
||||||
|
if SYNTHETIC_API_KEY is None:
|
||||||
|
report["litellm"]["api_models"] = None
|
||||||
|
report["litellm"]["checks"].append({"name": "api-endpoint", "status": "fail", "code": "no-key-file"})
|
||||||
|
else:
|
||||||
api_check = http_get(f"{LITELLM_PUBLIC}/v1/models", auth=SYNTHETIC_API_KEY)
|
api_check = http_get(f"{LITELLM_PUBLIC}/v1/models", auth=SYNTHETIC_API_KEY)
|
||||||
report["litellm"]["api_models"] = api_check
|
report["litellm"]["api_models"] = api_check
|
||||||
report["litellm"]["checks"].append({"name": "api-endpoint", "status": "pass" if api_check == "200" else "fail", "code": api_check})
|
report["litellm"]["checks"].append({"name": "api-endpoint", "status": "pass" if api_check == "200" else "fail", "code": api_check})
|
||||||
|
|||||||
Reference in New Issue
Block a user