Bootstrap minimal openclaw.json if missing (generate token); bump add-on to 0.5.7
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
name: OpenClaw Assistant
|
name: OpenClaw Assistant
|
||||||
version: "0.5.6"
|
version: "0.5.7"
|
||||||
slug: openclaw_assistant
|
slug: openclaw_assistant
|
||||||
description: Run OpenClaw Assistant (OpenClaw-compatible) as a Home Assistant add-on.
|
description: Run OpenClaw Assistant (OpenClaw-compatible) as a Home Assistant add-on.
|
||||||
url: https://github.com/techartdev/OpenClawHomeAssistant
|
url: https://github.com/techartdev/OpenClawHomeAssistant
|
||||||
|
|||||||
@@ -154,9 +154,36 @@ if ! command -v openclaw >/dev/null 2>&1; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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)..."
|
echo "Starting OpenClaw Assistant gateway (openclaw)..."
|
||||||
# Allow starting even if user hasn't completed onboarding / config wizard yet.
|
openclaw gateway run &
|
||||||
openclaw gateway run --allow-unconfigured &
|
|
||||||
GW_PID=$!
|
GW_PID=$!
|
||||||
|
|
||||||
# Start web terminal (optional)
|
# Start web terminal (optional)
|
||||||
|
|||||||
Reference in New Issue
Block a user