Spaces:
Running
Running
feat: configure Cloudflare proxy environment variables and update Telegram plugin settings with custom network and retry parameters
Browse files
start.sh
CHANGED
|
@@ -153,8 +153,11 @@ else
|
|
| 153 |
echo "HF_TOKEN is not set. Running without dataset persistence."
|
| 154 |
fi
|
| 155 |
|
|
|
|
|
|
|
| 156 |
CF_PROXY_ENV_FILE="/tmp/huggingclaw-cloudflare-proxy.env"
|
| 157 |
if [ -n "${CLOUDFLARE_WORKERS_TOKEN:-}" ] || [ -n "${CLOUDFLARE_PROXY_URL:-}" ]; then
|
|
|
|
| 158 |
echo "☁️ Preparing Cloudflare outbound proxy..."
|
| 159 |
python3 /home/node/app/cloudflare-proxy-setup.py || true
|
| 160 |
if [ -f "$CF_PROXY_ENV_FILE" ]; then
|
|
@@ -350,7 +353,22 @@ fi
|
|
| 350 |
if [ -n "${TELEGRAM_BOT_TOKEN:-}" ]; then
|
| 351 |
CONFIG_JSON=$(echo "$CONFIG_JSON" | jq '.plugins.entries.telegram = {"enabled": true}')
|
| 352 |
export TELEGRAM_BOT_TOKEN="$TELEGRAM_BOT_TOKEN"
|
| 353 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 354 |
|
| 355 |
if [ -n "${TELEGRAM_USER_IDS:-}" ]; then
|
| 356 |
# Convert comma-separated IDs to JSON array
|
|
|
|
| 153 |
echo "HF_TOKEN is not set. Running without dataset persistence."
|
| 154 |
fi
|
| 155 |
|
| 156 |
+
CLOUDFLARE_WORKERS_TOKEN="${CLOUDFLARE_WORKERS_TOKEN:-${CLOUDFLARE_API_TOKEN:-}}"
|
| 157 |
+
export CLOUDFLARE_WORKERS_TOKEN
|
| 158 |
CF_PROXY_ENV_FILE="/tmp/huggingclaw-cloudflare-proxy.env"
|
| 159 |
if [ -n "${CLOUDFLARE_WORKERS_TOKEN:-}" ] || [ -n "${CLOUDFLARE_PROXY_URL:-}" ]; then
|
| 160 |
+
export CLOUDFLARE_PROXY_DOMAINS="${CLOUDFLARE_PROXY_DOMAINS:-api.telegram.org,web.whatsapp.com}"
|
| 161 |
echo "☁️ Preparing Cloudflare outbound proxy..."
|
| 162 |
python3 /home/node/app/cloudflare-proxy-setup.py || true
|
| 163 |
if [ -f "$CF_PROXY_ENV_FILE" ]; then
|
|
|
|
| 353 |
if [ -n "${TELEGRAM_BOT_TOKEN:-}" ]; then
|
| 354 |
CONFIG_JSON=$(echo "$CONFIG_JSON" | jq '.plugins.entries.telegram = {"enabled": true}')
|
| 355 |
export TELEGRAM_BOT_TOKEN="$TELEGRAM_BOT_TOKEN"
|
| 356 |
+
export OPENCLAW_TELEGRAM_DISABLE_AUTO_SELECT_FAMILY=1
|
| 357 |
+
export OPENCLAW_TELEGRAM_DNS_RESULT_ORDER=ipv4first
|
| 358 |
+
CONFIG_JSON=$(echo "$CONFIG_JSON" | jq --arg token "$TELEGRAM_BOT_TOKEN" '
|
| 359 |
+
.channels.telegram.enabled = true
|
| 360 |
+
| .channels.telegram.botToken = $token
|
| 361 |
+
| .channels.telegram.commands.native = false
|
| 362 |
+
| .channels.telegram.timeoutSeconds = 60
|
| 363 |
+
| .channels.telegram.network.autoSelectFamily = false
|
| 364 |
+
| .channels.telegram.network.dnsResultOrder = "ipv4first"
|
| 365 |
+
| .channels.telegram.retry = {
|
| 366 |
+
"attempts": 5,
|
| 367 |
+
"minDelayMs": 800,
|
| 368 |
+
"maxDelayMs": 30000,
|
| 369 |
+
"jitter": 0.2
|
| 370 |
+
}
|
| 371 |
+
')
|
| 372 |
|
| 373 |
if [ -n "${TELEGRAM_USER_IDS:-}" ]; then
|
| 374 |
# Convert comma-separated IDs to JSON array
|