mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
Gate tool-gateway behind an env var, so it's not in users' faces until we're ready. Even if users enable it, it'll be blocked server-side for now, until we unlock for non-admin users on tool-gateway.
This commit is contained in:
parent
e95965d76a
commit
1cbb1b99cc
35 changed files with 426 additions and 147 deletions
19
utils.py
19
utils.py
|
|
@ -9,6 +9,25 @@ from typing import Any, Union
|
|||
import yaml
|
||||
|
||||
|
||||
TRUTHY_STRINGS = frozenset({"1", "true", "yes", "on"})
|
||||
|
||||
|
||||
def is_truthy_value(value: Any, default: bool = False) -> bool:
|
||||
"""Coerce bool-ish values using the project's shared truthy string set."""
|
||||
if value is None:
|
||||
return default
|
||||
if isinstance(value, bool):
|
||||
return value
|
||||
if isinstance(value, str):
|
||||
return value.strip().lower() in TRUTHY_STRINGS
|
||||
return bool(value)
|
||||
|
||||
|
||||
def env_var_enabled(name: str, default: str = "") -> bool:
|
||||
"""Return True when an environment variable is set to a truthy value."""
|
||||
return is_truthy_value(os.getenv(name, default), default=False)
|
||||
|
||||
|
||||
def atomic_json_write(
|
||||
path: Union[str, Path],
|
||||
data: Any,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue