tao-shen Claude Opus 4.6 commited on
Commit
bce2d13
·
1 Parent(s): 201eb72

fix: ensure password auth is set in all startup paths

Browse files

_patch_config() was only called after dataset restore, not on fresh
installs or when persistence is disabled. This caused the literal
placeholder __OPENCLAW_PASSWORD__ to be used as the actual password.

Now _patch_config() is called in all code paths, and
_ensure_default_config() also replaces the password placeholder.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. scripts/sync_hf.py +6 -0
scripts/sync_hf.py CHANGED
@@ -125,12 +125,14 @@ class OpenClawFullSync:
125
  if not self.enabled:
126
  print("[SYNC] Persistence disabled - skipping restore")
127
  self._ensure_default_config()
 
128
  self._ensure_telegram_credentials()
129
  return
130
 
131
  if not self.dataset_exists:
132
  print(f"[SYNC] Dataset {HF_REPO_ID} does not exist - starting fresh")
133
  self._ensure_default_config()
 
134
  self._ensure_telegram_credentials()
135
  return
136
 
@@ -259,6 +261,10 @@ class OpenClawFullSync:
259
  try:
260
  with open(config_path, "r") as f:
261
  cfg = json.load(f)
 
 
 
 
262
  if OPENROUTER_API_KEY:
263
  # Replace placeholder with actual key
264
  if "models" in cfg and "providers" in cfg["models"] and "openrouter" in cfg["models"]["providers"]:
 
125
  if not self.enabled:
126
  print("[SYNC] Persistence disabled - skipping restore")
127
  self._ensure_default_config()
128
+ self._patch_config()
129
  self._ensure_telegram_credentials()
130
  return
131
 
132
  if not self.dataset_exists:
133
  print(f"[SYNC] Dataset {HF_REPO_ID} does not exist - starting fresh")
134
  self._ensure_default_config()
135
+ self._patch_config()
136
  self._ensure_telegram_credentials()
137
  return
138
 
 
261
  try:
262
  with open(config_path, "r") as f:
263
  cfg = json.load(f)
264
+ # Replace password placeholder
265
+ if "gateway" in cfg and "auth" in cfg["gateway"]:
266
+ if cfg["gateway"]["auth"].get("password") == "__OPENCLAW_PASSWORD__":
267
+ cfg["gateway"]["auth"]["password"] = OPENCLAW_PASSWORD
268
  if OPENROUTER_API_KEY:
269
  # Replace placeholder with actual key
270
  if "models" in cfg and "providers" in cfg["models"] and "openrouter" in cfg["models"]["providers"]: