| | #!/usr/bin/env bash |
| | set -euo pipefail |
| |
|
| | mkdir -p "${CLAWDBOT_STATE_DIR:-/data}" |
| |
|
| | |
| | |
| | export HOME="${CLAWDBOT_STATE_DIR:-/data}" |
| | mkdir -p "$HOME" |
| |
|
| | CONFIG_FILE="$HOME/.clawdbot/moltbot.json" |
| |
|
| | |
| | |
| | |
| | if [[ ! -f "$CONFIG_FILE" ]]; then |
| | echo "[moltbot] No config found at $CONFIG_FILE" |
| |
|
| | |
| | if [[ -z "${CLAWDBOT_GATEWAY_TOKEN:-}" ]]; then |
| | echo "[moltbot] ERROR: Missing CLAWDBOT_GATEWAY_TOKEN (set it as a HF Secret)." |
| | exit 1 |
| | fi |
| |
|
| | |
| | if [[ -n "${ANTHROPIC_API_KEY:-}" ]]; then |
| | echo "[moltbot] Running non-interactive onboard (Anthropic)…" |
| | clawdbot onboard --non-interactive \ |
| | --mode local \ |
| | --auth-choice apiKey \ |
| | --anthropic-api-key "$ANTHROPIC_API_KEY" \ |
| | --gateway-port "${CLAWDBOT_GATEWAY_PORT:-7860}" \ |
| | --gateway-bind lan \ |
| | --skip-skills |
| | elif [[ -n "${GEMINI_API_KEY:-}" ]]; then |
| | echo "[moltbot] Running non-interactive onboard (Gemini)…" |
| | clawdbot onboard --non-interactive \ |
| | --mode local \ |
| | --auth-choice gemini-api-key \ |
| | --gemini-api-key "$GEMINI_API_KEY" \ |
| | --gateway-port "${CLAWDBOT_GATEWAY_PORT:-7860}" \ |
| | --gateway-bind lan \ |
| | --skip-skills |
| | else |
| | echo "[moltbot] ERROR: No supported model API key found." |
| | echo "Set one of these HF Secrets: ANTHROPIC_API_KEY or GEMINI_API_KEY" |
| | exit 1 |
| | fi |
| | else |
| | echo "[moltbot] Config found at $CONFIG_FILE (skipping onboard)" |
| | fi |
| |
|
| | echo "[moltbot] Starting gateway on :${CLAWDBOT_GATEWAY_PORT:-7860} (bind: lan)" |
| | |
| | |
| | clawdbot gateway --allow-unconfigured --port "${CLAWDBOT_GATEWAY_PORT:-7860}" --bind lan |