8900 commited on
Commit
aef4141
·
verified ·
1 Parent(s): 984460d

Update entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +6 -43
entrypoint.sh CHANGED
@@ -1,55 +1,18 @@
1
  #!/bin/sh
2
 
3
- # OpenClaw HF Spaces - Production Entrypoint
4
-
5
- # -- resolve writable home --
6
-
7
- if mkdir -p /data/.openclaw 2>/dev/null; then
8
- export OPENCLAW_HOME=/data
9
- else
10
- export OPENCLAW_HOME=/home/user
11
- mkdir -p /home/user/.openclaw
12
- fi
13
  echo "[entrypoint] OPENCLAW_HOME=$OPENCLAW_HOME"
14
 
15
- # -- dynamic provider key export --
16
-
17
  for VAR in $(env | cut -d= -f1); do
18
  case "$VAR" in
19
- OPENCLAW_*|SPACE_*|SYSTEM_*|HF_*|NODE_*|npm_*) continue ;;
20
- esac
21
- case "$VAR" in
22
- *_API_KEY|*_SECRET_KEY|*_ACCESS_TOKEN|*_BOT_TOKEN|*_AUTH_TOKEN|*_APP_KEY)
23
  VAL=$(printenv "$VAR" 2>/dev/null || true)
24
- if [ -n "$VAL" ]; then
25
- export "$VAR"
26
- echo "[entrypoint] exported: $VAR"
27
- fi
28
  ;;
29
  esac
30
  done
31
 
32
- # HF_TOKEN exported separately
33
- export HF_TOKEN="${HF_TOKEN:-}"
34
-
35
- # -- write openclaw config --
36
- echo "[entrypoint] Running setup..."
37
- node /app/spaces/huggingface/setup-hf-config.mjs || true
38
- echo "[entrypoint] Setup done."
39
-
40
- # -- security audit (non-fatal) --
41
- if [ -f /app/security-check.sh ]; then
42
- sh /app/security-check.sh || true
43
- fi
44
-
45
- # -- start sync manager in background --
46
- if [ -f /app/hf-sync-manager.mjs ]; then
47
- (node /app/hf-sync-manager.mjs &)
48
- echo "[entrypoint] Sync manager started"
49
- fi
50
 
51
- echo "[entrypoint] Starting gateway..."
52
- exec node /app/openclaw.mjs gateway \
53
- --allow-unconfigured \
54
- --bind lan \
55
- --port 7860
 
1
  #!/bin/sh
2
 
 
 
 
 
 
 
 
 
 
 
3
  echo "[entrypoint] OPENCLAW_HOME=$OPENCLAW_HOME"
4
 
5
+ # 只导出 keys
 
6
  for VAR in $(env | cut -d= -f1); do
7
  case "$VAR" in
8
+ *_API_KEY|*_SECRET_KEY|*_ACCESS_TOKEN|*_BOT_TOKEN)
 
 
 
9
  VAL=$(printenv "$VAR" 2>/dev/null || true)
10
+ if [ -n "$VAL" ]; then export "$VAR"; echo "[entrypoint] exported: $VAR"; fi
 
 
 
11
  ;;
12
  esac
13
  done
14
 
15
+ echo "[entrypoint] Setup skipped for clean test"
16
+ echo "[entrypoint] Starting gateway directly..."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
+ exec node /app/openclaw.mjs gateway --allow-unconfigured --bind lan --port 7860