Update entrypoint.sh
Browse files- entrypoint.sh +37 -20
entrypoint.sh
CHANGED
|
@@ -1,5 +1,8 @@
|
|
| 1 |
#!/bin/sh
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
if mkdir -p /data/.openclaw 2>/dev/null; then
|
| 5 |
export OPENCLAW_HOME=/data
|
|
@@ -9,30 +12,44 @@ else
|
|
| 9 |
fi
|
| 10 |
echo "[entrypoint] OPENCLAW_HOME=$OPENCLAW_HOME"
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
export HF_TOKEN="${HF_TOKEN:-}"
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
echo "[entrypoint] Running setup
|
| 21 |
node /app/spaces/huggingface/setup-hf-config.mjs || true
|
| 22 |
echo "[entrypoint] Setup done."
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
[ -f /app/security-check.sh ]
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
[ -f /app/hf-sync-manager.mjs ] && node /app/hf-sync-manager.mjs & echo "[entrypoint] Sync manager started (PID $!)"
|
| 29 |
|
| 30 |
-
#
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
| 33 |
|
| 34 |
-
echo "[entrypoint] Starting gateway
|
| 35 |
exec node /app/openclaw.mjs gateway \
|
| 36 |
-
--allow-unconfigured \
|
| 37 |
-
--bind lan \
|
| 38 |
-
--port 7860
|
|
|
|
| 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
|
|
|
|
| 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
|