Upload 7 files
Browse files- start-openclaw.sh +24 -3
start-openclaw.sh
CHANGED
|
@@ -135,7 +135,21 @@ openclaw config set model.thinking false 2>/dev/null || true
|
|
| 135 |
openclaw config set fastMode.enabled true 2>/dev/null || true
|
| 136 |
openclaw config set stream true 2>/dev/null || true
|
| 137 |
# 强制信任反向代理(HF Spaces 入口,覆盖 IPv4/IPv6),避免 proxy_attribution_required
|
| 138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
|
| 140 |
if [ "$QQ_BOT_ENABLED" = "true" ]; then
|
| 141 |
echo "QQ Official Bot: enabled appId=${QQ_APP_ID}"
|
|
@@ -180,8 +194,15 @@ graceful_shutdown() {
|
|
| 180 |
}
|
| 181 |
trap graceful_shutdown SIGTERM SIGINT
|
| 182 |
|
| 183 |
-
# 诊断:
|
| 184 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
|
| 186 |
# 后台启动 Gateway,前台等待,让 trap 能捕获信号
|
| 187 |
openclaw gateway run --port "$PORT" --bind lan &
|
|
|
|
| 135 |
openclaw config set fastMode.enabled true 2>/dev/null || true
|
| 136 |
openclaw config set stream true 2>/dev/null || true
|
| 137 |
# 强制信任反向代理(HF Spaces 入口,覆盖 IPv4/IPv6),避免 proxy_attribution_required
|
| 138 |
+
# 直接用 Python 写 JSON,绕过 CLI 对数组值的解析差异
|
| 139 |
+
python3 -c "
|
| 140 |
+
import json
|
| 141 |
+
p = '/root/.openclaw/openclaw.json'
|
| 142 |
+
try:
|
| 143 |
+
with open(p) as f:
|
| 144 |
+
c = json.load(f)
|
| 145 |
+
except Exception as e:
|
| 146 |
+
print('WARN: cannot read config, creating new:', e)
|
| 147 |
+
c = {'gateway': {}}
|
| 148 |
+
c.setdefault('gateway', {})['trustedProxies'] = ['0.0.0.0/0', '::/0']
|
| 149 |
+
with open(p, 'w') as f:
|
| 150 |
+
json.dump(c, f, indent=2, ensure_ascii=False)
|
| 151 |
+
print('FORCED gateway.trustedProxies =', c['gateway']['trustedProxies'])
|
| 152 |
+
"
|
| 153 |
|
| 154 |
if [ "$QQ_BOT_ENABLED" = "true" ]; then
|
| 155 |
echo "QQ Official Bot: enabled appId=${QQ_APP_ID}"
|
|
|
|
| 194 |
}
|
| 195 |
trap graceful_shutdown SIGTERM SIGINT
|
| 196 |
|
| 197 |
+
# 诊断:直接从 JSON 文件读取 trustedProxies,确认实际生效值
|
| 198 |
+
python3 -c "
|
| 199 |
+
import json
|
| 200 |
+
with open('/root/.openclaw/openclaw.json') as f:
|
| 201 |
+
c = json.load(f)
|
| 202 |
+
print('DIAG gateway.trustedProxies =', c.get('gateway', {}).get('trustedProxies', 'MISSING'))
|
| 203 |
+
print('DIAG gateway.bind =', c.get('gateway', {}).get('bind', 'MISSING'))
|
| 204 |
+
print('DIAG full gateway =', json.dumps(c.get('gateway', {}), indent=2))
|
| 205 |
+
"
|
| 206 |
|
| 207 |
# 后台启动 Gateway,前台等待,让 trap 能捕获信号
|
| 208 |
openclaw gateway run --port "$PORT" --bind lan &
|