renminwansui1976 commited on
Commit
e2a0fa2
·
unverified ·
1 Parent(s): 58f10f3

更新 start.sh

Browse files
Files changed (1) hide show
  1. start.sh +15 -6
start.sh CHANGED
@@ -8,21 +8,30 @@ OPENCLAW_CONFIG_DIR="${HOME}/.openclaw"
8
  OPENCLAW_CONFIG="${OPENCLAW_CONFIG_DIR}/openclaw.json"
9
  mkdir -p "$OPENCLAW_CONFIG_DIR"
10
 
11
- if [ ! -f "$OPENCLAW_CONFIG" ]; then
12
- cat > "$OPENCLAW_CONFIG" << 'OPENCLAW_JSON'
 
 
 
 
13
  {
14
  "gateway": {
15
  "bind": "lan",
 
 
 
 
16
  "controlUi": {
 
 
17
  "dangerouslyAllowHostHeaderOriginFallback": true
18
  }
19
  }
20
  }
21
  OPENCLAW_JSON
22
- echo "[start.sh] openclaw.json written"
23
- else
24
- echo "[start.sh] openclaw.json already exists, skipping write"
25
- fi
26
 
27
  # ── 1. Check if LiteLLM should be enabled ─────────────────────────────────────
28
  if [ -z "${LITELLM_API_KEY:-}" ] || [ -z "${LITELLM_MODEL:-}" ]; then
 
8
  OPENCLAW_CONFIG="${OPENCLAW_CONFIG_DIR}/openclaw.json"
9
  mkdir -p "$OPENCLAW_CONFIG_DIR"
10
 
11
+ # Pin the gateway token so it never changes between restarts.
12
+ # Set OPENCLAW_GATEWAY_TOKEN in HF Space Secrets for a custom token.
13
+ # Access the UI via: https://your-space.hf.space/#token=<your-token>
14
+ GATEWAY_TOKEN="${OPENCLAW_GATEWAY_TOKEN:-openclaw-hf-default-token}"
15
+
16
+ cat > "$OPENCLAW_CONFIG" << OPENCLAW_JSON
17
  {
18
  "gateway": {
19
  "bind": "lan",
20
+ "auth": {
21
+ "mode": "token",
22
+ "token": "${GATEWAY_TOKEN}"
23
+ },
24
  "controlUi": {
25
+ "allowInsecureAuth": true,
26
+ "dangerouslyDisableDeviceAuth": true,
27
  "dangerouslyAllowHostHeaderOriginFallback": true
28
  }
29
  }
30
  }
31
  OPENCLAW_JSON
32
+
33
+ echo "[start.sh] openclaw.json written (token=${GATEWAY_TOKEN:0:8}...)"
34
+ echo "[start.sh] Access UI at: https://<your-space>.hf.space/#token=${GATEWAY_TOKEN}"
 
35
 
36
  # ── 1. Check if LiteLLM should be enabled ─────────────────────────────────────
37
  if [ -z "${LITELLM_API_KEY:-}" ] || [ -z "${LITELLM_MODEL:-}" ]; then