feat: add update service env label
This commit is contained in:
@ -231,8 +231,16 @@ def get_service_status(settings: Settings) -> Dict[str, Any]:
|
||||
"status_code": None,
|
||||
"error": "update service url not configured",
|
||||
"checked_url": "",
|
||||
"environment": "unknown",
|
||||
}
|
||||
|
||||
env = "prod"
|
||||
lowered = base_url.lower()
|
||||
if "://dev." in lowered or lowered.startswith("dev."):
|
||||
env = "dev"
|
||||
elif "://staging." in lowered or lowered.startswith("staging."):
|
||||
env = "staging"
|
||||
|
||||
check_url = base_url
|
||||
try:
|
||||
with httpx.Client(timeout=3.0) as client:
|
||||
@ -243,6 +251,7 @@ def get_service_status(settings: Settings) -> Dict[str, Any]:
|
||||
"status_code": response.status_code,
|
||||
"error": None,
|
||||
"checked_url": check_url,
|
||||
"environment": env,
|
||||
}
|
||||
except Exception as exc:
|
||||
return {
|
||||
@ -251,4 +260,5 @@ def get_service_status(settings: Settings) -> Dict[str, Any]:
|
||||
"status_code": None,
|
||||
"error": str(exc),
|
||||
"checked_url": check_url,
|
||||
"environment": env,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user