From 62ef146c3baed9a8e93d5f4935eaeddc749845fc Mon Sep 17 00:00:00 2001 From: root Date: Sat, 31 Jan 2026 00:29:34 +0200 Subject: [PATCH] Bootstrap minimal openclaw.json if missing (generate token); bump add-on to 0.5.7 --- openclaw_assistant/config.yaml | 2 +- openclaw_assistant/run.sh | 31 +++++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/openclaw_assistant/config.yaml b/openclaw_assistant/config.yaml index ee0562d..286988e 100644 --- a/openclaw_assistant/config.yaml +++ b/openclaw_assistant/config.yaml @@ -1,5 +1,5 @@ name: OpenClaw Assistant -version: "0.5.6" +version: "0.5.7" slug: openclaw_assistant description: Run OpenClaw Assistant (OpenClaw-compatible) as a Home Assistant add-on. url: https://github.com/techartdev/OpenClawHomeAssistant diff --git a/openclaw_assistant/run.sh b/openclaw_assistant/run.sh index b8c266a..5a7ddbe 100644 --- a/openclaw_assistant/run.sh +++ b/openclaw_assistant/run.sh @@ -154,9 +154,36 @@ if ! command -v openclaw >/dev/null 2>&1; then exit 1 fi +# Bootstrap minimal OpenClaw config ONLY if missing. +# We do not overwrite or patch existing configs; onboarding owns everything else. +OPENCLAW_CONFIG_PATH="/config/.openclaw/openclaw.json" +if [ ! -f "$OPENCLAW_CONFIG_PATH" ]; then + echo "INFO: OpenClaw config missing; bootstrapping minimal config at $OPENCLAW_CONFIG_PATH" + python3 - <<'PY' +import json +import secrets +from pathlib import Path + +cfg_path = Path('/config/.openclaw/openclaw.json') +cfg_path.parent.mkdir(parents=True, exist_ok=True) + +cfg = { + "gateway": { + "mode": "local", + "auth": { + "mode": "token", + "token": secrets.token_urlsafe(24) + } + } +} + +cfg_path.write_text(json.dumps(cfg, indent=2) + "\n", encoding='utf-8') +print("INFO: Wrote minimal OpenClaw config (gateway.mode=local, auth.token generated)") +PY +fi + echo "Starting OpenClaw Assistant gateway (openclaw)..." -# Allow starting even if user hasn't completed onboarding / config wizard yet. -openclaw gateway run --allow-unconfigured & +openclaw gateway run & GW_PID=$! # Start web terminal (optional)