mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00: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:
parent
d0821b0573
commit
78d1e252fa
1 changed files with 8 additions and 1 deletions
|
|
@ -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]:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue