File size: 1,312 Bytes
b5f18a8
 
 
 
 
 
 
dff74aa
b5f18a8
bb7ec5e
 
 
 
 
 
 
 
 
02a2149
 
b5f18a8
bb7ec5e
 
 
215b453
 
 
 
 
 
bb7ec5e
 
b5f18a8
 
 
 
 
 
dff74aa
b5f18a8
 
29b97cc
b5f18a8
 
 
 
 
 
 
 
 
 
02a2149
 
 
b5f18a8
db81bb8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env sh
set -e

mkdir -p /data/config /data/workspace /data/state

PORT_VALUE="${CLAWDBOT_GATEWAY_PORT:-${PORT:-7860}}"

CONFIG_PATH="${CLAWDBOT_CONFIG_PATH:-/data/config/clawdbot.json}"

TELEGRAM_ENABLED="false"
if [ "${ENABLE_TELEGRAM:-0}" = "1" ] && [ -n "${TELEGRAM_BOT_TOKEN:-}" ]; then
  if node -e "fetch('https://api.telegram.org').then(()=>process.exit(0)).catch(()=>process.exit(1))"; then
    TELEGRAM_ENABLED="true"
  else
    echo "Telegram API is not reachable from this runtime; starting with Telegram disabled." 1>&2
  fi
fi

if [ ! -f "$CONFIG_PATH" ]; then
  cat >"$CONFIG_PATH" <<EOF
{
  "channels": {
    "telegram": {
      "enabled": $TELEGRAM_ENABLED,
      "botToken": "${TELEGRAM_BOT_TOKEN:-}",
      "dmPolicy": "pairing",
      "commands": {
        "native": false,
        "nativeSkills": false
      }
    }
  },
  "gateway": {
    "mode": "local",
    "bind": "lan",
    "port": $PORT_VALUE,
    "auth": {
      "mode": "token",
      "token": "${CLAWDBOT_GATEWAY_TOKEN:-}"
    },
    "controlUi": {
      "enabled": true,
      "allowInsecureAuth": true
    }
  },
  "agents": {
    "defaults": {
      "workspace": "/data/workspace"
    }
  }
}
EOF
fi

clawdbot doctor --yes || true

exec clawdbot gateway --bind lan --port "$PORT_VALUE" --allow-unconfigured --verbose