Files
metapi/.env.example
Fierushio 9c2e8d6a76 feat: make Telegram Bot API base URL configurable
* docs: add missing Telegram env vars to .env.example

TELEGRAM_API_BASE_URL, TELEGRAM_MESSAGE_THREAD_ID, and
TELEGRAM_USE_SYSTEM_PROXY were supported in config.ts but absent from
the example file.

* fix(config): read TELEGRAM_API_BASE_URL from environment

telegramApiBaseUrl was hardcoded to 'https://api.telegram.org' with no
env var override, preventing users in restricted networks (mainland
China, self-hosted bot-api servers) from pointing metapi at a proxy.

Now reads TELEGRAM_API_BASE_URL with fallback to the official endpoint,
trims whitespace, and strips trailing slashes — matching the pattern
already applied in notifyService.ts line ~80.

* fix: make telegramApiBaseUrl configurable via TELEGRAM_API_BASE_URL env var

Hardcoding https://api.telegram.org prevents users behind the Great Firewall
or running a self-hosted Bot API server from configuring a proxy base URL.

Read the base URL from TELEGRAM_API_BASE_URL (fallback to official endpoint)
and strip trailing slashes.

* test: cover TELEGRAM_API_BASE_URL resolution in buildConfig

* style: drop stray trailing newline

* fix(config): normalize TELEGRAM_API_BASE_URL before applying the default

* test: cover whitespace-only TELEGRAM_API_BASE_URL fallback
2026-08-30 14:00:04 +08:00

34 lines
1.1 KiB
Bash

# Required in production: generate a unique 32+ byte random secret in your local .env, keep it out of git, and do not reuse AUTH_TOKEN.
ACCOUNT_CREDENTIAL_SECRET=REPLACE_WITH_STRONG_RANDOM_SECRET
AUTH_TOKEN=change-me-admin-token
CHECKIN_CRON=0 8 * * *
BALANCE_REFRESH_CRON=0 * * * *
# Optional OAuth overrides. Fill the matching credentials when an override is enabled; Claude requires a client secret with no fallback.
CLAUDE_CLIENT_ID=
CLAUDE_CLIENT_SECRET=
# Codex OAuth override only needs CODEX_CLIENT_ID.
CODEX_CLIENT_ID=
# Gemini CLI override requires both GEMINI_CLI_CLIENT_ID and GEMINI_CLI_CLIENT_SECRET together.
GEMINI_CLI_CLIENT_ID=
GEMINI_CLI_CLIENT_SECRET=
PROXY_TOKEN=change-me-proxy-sk-token
SYSTEM_PROXY_URL=
WEBHOOK_URL=
BARK_URL=
SERVERCHAN_KEY=
TELEGRAM_ENABLED=false
TELEGRAM_BOT_TOKEN=
TELEGRAM_CHAT_ID=
TELEGRAM_API_BASE_URL=
TELEGRAM_MESSAGE_THREAD_ID=
TELEGRAM_USE_SYSTEM_PROXY=false
MODEL_AVAILABILITY_PROBE_CONCURRENCY=1
MODEL_AVAILABILITY_PROBE_ENABLED=false
MODEL_AVAILABILITY_PROBE_INTERVAL_MS=1800000
MODEL_AVAILABILITY_PROBE_TIMEOUT_MS=15000
PORT=4000
DATA_DIR=./data
NOTIFY_COOLDOWN_SEC=300
ADMIN_IP_ALLOWLIST=
TZ=Asia/Shanghai