Farhan Beg commited on
Commit Β·
70042cf
1
Parent(s): 69b7182
fix(config): strip deprecated TERMINAL_CWD from .env on boot
Browse filesHermes v0.17.0 deprecated TERMINAL_CWD in favor of config.yaml's
terminal.cwd and warns on every gateway start:
'Deprecated .env settings detected: TERMINAL_CWD=/opt/data/workspace'
config.yaml already has terminal.cwd set correctly (line 295), so the
.env entry is pure cruft. It's excluded from HF Dataset backup
(hermes-sync.py EXCLUDED_TOP_LEVEL), but the dashboard Env tab / older
Hermes versions can re-add it at runtime. Strip it on every boot right
after config.yaml is written so the warning stays gone.
start.sh
CHANGED
|
@@ -315,6 +315,23 @@ if os.environ.get("TELEGRAM_BOT_TOKEN"):
|
|
| 315 |
|
| 316 |
path.write_text(yaml.safe_dump(config, sort_keys=False), encoding="utf-8")
|
| 317 |
path.chmod(0o600)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 318 |
PY
|
| 319 |
|
| 320 |
# ββ Startup summary βββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
|
|
| 315 |
|
| 316 |
path.write_text(yaml.safe_dump(config, sort_keys=False), encoding="utf-8")
|
| 317 |
path.chmod(0o600)
|
| 318 |
+
|
| 319 |
+
# config.yaml now carries terminal.cwd (above), so TERMINAL_CWD in .env is
|
| 320 |
+
# redundant. Hermes v0.17.0 deprecated it and warns on every gateway
|
| 321 |
+
# start ("Deprecated .env settings detected: TERMINAL_CWD=..."). The
|
| 322 |
+
# dashboard Env tab / older Hermes versions may re-add it; strip it on
|
| 323 |
+
# every boot so the warning stays gone.
|
| 324 |
+
env_file = home / ".env"
|
| 325 |
+
if env_file.exists():
|
| 326 |
+
try:
|
| 327 |
+
lines = env_file.read_text(encoding="utf-8", errors="replace").splitlines()
|
| 328 |
+
kept = [ln for ln in lines if not ln.strip().startswith("TERMINAL_CWD=")]
|
| 329 |
+
if len(kept) != len(lines):
|
| 330 |
+
env_file.write_text("\n".join(kept).rstrip() + "\n", encoding="utf-8")
|
| 331 |
+
env_file.chmod(0o600)
|
| 332 |
+
print(f"Removed deprecated TERMINAL_CWD from {env_file}")
|
| 333 |
+
except OSError as exc:
|
| 334 |
+
print(f"Warning: could not clean {env_file}: {exc}")
|
| 335 |
PY
|
| 336 |
|
| 337 |
# ββ Startup summary βββββββββββββββββββββββββββββββββββββββββββββββββββ
|