mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-28 06:51:16 +08:00
fix(web_server): guard GATEWAY_HEALTH_TIMEOUT against invalid env values
float(os.getenv(...)) at module level raises ValueError on any non-numeric value, crashing the web server at import before it starts. Wrap in try/except with a warning log and fallback to 3.0s.
This commit is contained in:
@@ -431,7 +431,14 @@ class EnvVarReveal(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
_GATEWAY_HEALTH_URL = os.getenv("GATEWAY_HEALTH_URL")
|
_GATEWAY_HEALTH_URL = os.getenv("GATEWAY_HEALTH_URL")
|
||||||
_GATEWAY_HEALTH_TIMEOUT = float(os.getenv("GATEWAY_HEALTH_TIMEOUT", "3"))
|
try:
|
||||||
|
_GATEWAY_HEALTH_TIMEOUT = float(os.getenv("GATEWAY_HEALTH_TIMEOUT", "3"))
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
_log.warning(
|
||||||
|
"Invalid GATEWAY_HEALTH_TIMEOUT value %r — using default 3.0s",
|
||||||
|
os.getenv("GATEWAY_HEALTH_TIMEOUT"),
|
||||||
|
)
|
||||||
|
_GATEWAY_HEALTH_TIMEOUT = 3.0
|
||||||
|
|
||||||
|
|
||||||
def _probe_gateway_health() -> tuple[bool, dict | None]:
|
def _probe_gateway_health() -> tuple[bool, dict | None]:
|
||||||
|
|||||||
Reference in New Issue
Block a user