# PolyWeather backend/bot minimal reproducible config # Full configuration guide: # docs/CONFIGURATION_ZH.md # Sensitive-only template: # .env.secrets.example ######################################## # 1) Runtime paths and base behavior ######################################## ENV=production LOG_LEVEL=INFO POLYWEATHER_MAP_URL=https://polyweather.top/ POLYWEATHER_RUNTIME_DATA_DIR=/var/lib/polyweather POLYWEATHER_DB_PATH=/var/lib/polyweather/polyweather.db OPEN_METEO_DISK_CACHE_PATH=/var/lib/polyweather/open_meteo_cache.json UVICORN_WORKERS=1 # Optional: host user/group mapping for Docker on Linux. # Windows / macOS can usually keep the defaults. UID=1000 GID=1000 POLYWEATHER_STATE_STORAGE_MODE=sqlite # Realtime chart event store. Production should use Redis Stream; local/single-process # development can set POLYWEATHER_EVENT_STORE=sqlite. POLYWEATHER_EVENT_STORE=redis POLYWEATHER_REDIS_URL=redis://polyweather_redis:6379/0 POLYWEATHER_REDIS_STREAM_KEY=stream:city_observation POLYWEATHER_REDIS_STREAM_MAXLEN=50000 POLYWEATHER_REDIS_REQUIRED=true # Backend CORS allowlist. Add your Vercel production/preview domains when # NEXT_PUBLIC_POLYWEATHER_API_BASE_URL points browsers directly at this backend. WEB_CORS_ORIGINS=http://localhost:3000,http://127.0.0.1:3000,https://polyweather.top,https://www.polyweather.top,https://api.polyweather.top ######################################## # 2) Telegram bot minimal ######################################## TELEGRAM_BOT_TOKEN= TELEGRAM_CHAT_ID= TELEGRAM_CHAT_IDS= POLYWEATHER_TELEGRAM_GROUP_ID= # Optional: restrict message-points accrual to these chat IDs. # Example: POLYWEATHER_BOT_POINTS_CHAT_IDS=-1003965137823 POLYWEATHER_BOT_POINTS_CHAT_IDS= POLYWEATHER_GROUP_MEMBER_PRICE_USDC=5 POLYWEATHER_PUBLIC_PRICE_USDC=10 TELEGRAM_QUERY_TOPIC_CHAT_ID= TELEGRAM_QUERY_TOPIC_ID= TELEGRAM_QUERY_TOPIC_MAP= POLYWEATHER_BOT_GROUP_INVITE_URL= POLYWEATHER_APP_URL=https://polyweather.top # Global Telegram auto-push copy: both, en, or zh. Module-specific vars can override it. TELEGRAM_PUSH_LANGUAGE=both # High-frequency airport push loop. Keep workers at 1 on shared VPS. TELEGRAM_AIRPORT_PUSH_ENABLED=true TELEGRAM_AIRPORT_PUSH_INTERVAL_SEC=60 TELEGRAM_AIRPORT_PUSH_MAX_WORKERS=1 # Optional airport-only override. TELEGRAM_AIRPORT_PUSH_LANGUAGE=both # Docker-only safety limits for the bot service. POLYWEATHER_BOT_CPUS=0.75 POLYWEATHER_BOT_MEM_LIMIT=768m POLYWEATHER_BOT_MEMSWAP_LIMIT=1g POLYWEATHER_BOT_AIRPORT_PUSH_INTERVAL_SEC=60 POLYWEATHER_BOT_AIRPORT_PUSH_MAX_WORKERS=1 ######################################## # 3) Weather + cache ######################################## OPEN_METEO_CACHE_TTL_SEC=21600 OPEN_METEO_ENSEMBLE_CACHE_TTL_SEC=21600 OPEN_METEO_MULTI_MODEL_CACHE_TTL_SEC=21600 OPEN_METEO_MULTI_MODEL_CACHE_VERSION=v2 OPEN_METEO_RATE_LIMIT_COOLDOWN_SEC=3600 OPEN_METEO_RATE_CACHE_TTL_SEC=3600 OPEN_METEO_MIN_CALL_INTERVAL_SEC=5 POLYWEATHER_SCAN_TERMINAL_MAX_WORKERS=1 POLYWEATHER_SCAN_TERMINAL_PAYLOAD_TTL_SEC=600 POLYWEATHER_SCAN_TERMINAL_BUILD_TIMEOUT_SEC=45 POLYWEATHER_HTTP_TIMEOUT_SEC=8 POLYWEATHER_HTTP_RETRY_COUNT=0 POLYWEATHER_HTTP_RETRY_BACKOFF_SEC=0.2 POLYWEATHER_OPEN_METEO_TIMEOUT_SEC=5 POLYWEATHER_METAR_TIMEOUT_SEC=4 POLYWEATHER_METAR_CLUSTER_TIMEOUT_SEC=3.5 METAR_CACHE_TTL_SEC=600 JMA_AMEDAS_CACHE_TTL_SEC=120 # ── Country-specific data source URLs ── # These are kept in .env to avoid exposing competitive data-source discovery # work on the public GitHub repository. Leave empty to use built-in defaults. # AMSC_AWOS_BASE_URL=https://www.amsc.net.cn/gateway/api/saas/rest/amc/AwosController/getWindPlate # KMA_BASE_URL=https://www.weather.go.kr # AMOS_BASE_URL=https://global.amo.go.kr/amosobsnew/AmosRealTimeImage.do # JMA_AMEDAS_BASE_URL=https://www.jma.go.jp # MGM_BASE_URL=https://servis.mgm.gov.tr/web # MGM_ORIGIN_URL=https://www.mgm.gov.tr # FMI_BASE_URL=https://opendata.fmi.fi/wfs # HKO_BASE_URL=https://data.weather.gov.hk/weatherAPI/hko_data/regional-weather # SINGAPORE_MSS_BASE_URL=https://api.data.gov.sg/v1/environment/air-temperature ######################################## # 4) Auth / entitlement ######################################## POLYWEATHER_AUTH_ENABLED=false POLYWEATHER_AUTH_REQUIRED=false POLYWEATHER_AUTH_REQUIRE_SUBSCRIPTION=false POLYWEATHER_REQUIRE_ENTITLEMENT=false SUPABASE_URL= SUPABASE_ANON_KEY= SUPABASE_SERVICE_ROLE_KEY= SUPABASE_HTTP_TIMEOUT_SEC=8 SUPABASE_AUTH_CACHE_TTL_SEC=30 SUPABASE_SUB_CACHE_TTL_SEC=60 POLYWEATHER_BACKEND_ENTITLEMENT_TOKEN= POLYWEATHER_TELEGRAM_JOIN_INELIGIBLE_ACTION=decline ######################################## # 5) Operations ######################################## POLYWEATHER_MONITORING_ALERT_CHAT_IDS= ######################################## # 6) Frontend-facing shared values ######################################## NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID= NEXT_PUBLIC_WALLETCONNECT_POLYGON_RPC_URL=https://polygon-bor-rpc.publicnode.com # Optional: disable homepage city summary preloading. Default is enabled. NEXT_PUBLIC_POLYWEATHER_DISABLE_EAGER_SUMMARIES=false # Optional: browser-visible FastAPI base URL for Vercel deployments. # Set this to your VPS HTTPS origin to let AI / METAR / scan dashboard calls # bypass Vercel Functions / Fluid Compute instead of going through Next.js API proxies. # Example: NEXT_PUBLIC_POLYWEATHER_API_BASE_URL=https://api.example.com NEXT_PUBLIC_POLYWEATHER_API_BASE_URL= # Set to "false" to disable app analytics event tracking (conversion funnel etc.) # Default: enabled. Only set this if you need to opt out. NEXT_PUBLIC_POLYWEATHER_APP_ANALYTICS=true ######################################## # 7) Admin / Ops ######################################## # Comma-separated admin email list for /ops dashboard access POLYWEATHER_OPS_ADMIN_EMAILS= # KNMI 10-minute observation data (Amsterdam) KNMI_API_KEY= ######################################## # 8) Optional modules ######################################## POLYWEATHER_CITY_SUMMARY_CACHE_TTL_SEC=1800 POLYWEATHER_CITY_PANEL_CACHE_TTL_SEC=1800 POLYWEATHER_CITY_NEARBY_CACHE_TTL_SEC=1800 POLYWEATHER_CITY_MARKET_CACHE_TTL_SEC=1800 POLYWEATHER_CITY_HISTORY_PREVIEW_CACHE_TTL_SEC=1800 # Weekly reward / leaderboard POLYWEATHER_WEEKLY_REWARD_ENABLED=true POLYWEATHER_WEEKLY_REWARD_TIMEZONE=Asia/Shanghai POLYWEATHER_WEEKLY_REWARD_SETTLE_WEEKDAY=1 POLYWEATHER_WEEKLY_REWARD_SETTLE_HOUR=0 POLYWEATHER_WEEKLY_REWARD_SETTLE_MINUTE=5 POLYWEATHER_WEEKLY_REWARD_CHECK_INTERVAL_SEC=300 POLYWEATHER_WEEKLY_REWARD_HTTP_TIMEOUT_SEC=10 POLYWEATHER_WEEKLY_REWARD_ANNOUNCE_ENABLED=true # Group message points POLYWEATHER_BOT_MESSAGE_POINTS=4 POLYWEATHER_BOT_MESSAGE_DAILY_CAP=40 POLYWEATHER_BOT_MESSAGE_MIN_LENGTH=3 POLYWEATHER_BOT_MESSAGE_COOLDOWN_SEC=30 POLYWEATHER_BOT_CITY_QUERY_COST=1 POLYWEATHER_BOT_DEB_QUERY_COST=1 # Payments POLYWEATHER_PAYMENT_ENABLED=false # Default / legacy checkout chain. Keep Polygon as the default because the # deployed checkout contract currently lives there. POLYWEATHER_PAYMENT_CHAIN_ID=137 POLYWEATHER_PAYMENT_RPC_URL=https://polygon-rpc.com POLYWEATHER_PAYMENT_RPC_URLS=https://polygon-rpc.com # Optional multi-chain RPC map. Required when accepting non-default chain # transfers such as Ethereum mainnet USDC. # Example: # POLYWEATHER_PAYMENT_RPC_URLS_BY_CHAIN_JSON={"137":["https://polygon-rpc.com"],"1":["https://ethereum-rpc.example"]} POLYWEATHER_PAYMENT_RPC_URLS_BY_CHAIN_JSON= POLYWEATHER_PAYMENT_RECEIVER_CONTRACT= POLYWEATHER_PAYMENT_DIRECT_RECEIVER_ADDRESS= POLYWEATHER_PAYMENT_TOKEN_ADDRESS=0x3c499c542cef5e3811e1192ce70d8cc03d5c3359 POLYWEATHER_PAYMENT_TOKEN_DECIMALS=6 # Multi-token / multi-chain payment routes. Token rows can include: # chain_id, chain_code, chain_name, receiver_contract, direct_receiver_address, # supports_contract_checkout, supports_direct_transfer, confirmations, # explorer_tx_url. POLYWEATHER_PAYMENT_ACCEPTED_TOKENS_JSON= POLYWEATHER_PAYMENT_CONFIRMATIONS=2 POLYWEATHER_PAYMENT_INTENT_TTL_SEC=1800 POLYWEATHER_PAYMENT_WALLET_CHALLENGE_TTL_SEC=600 POLYWEATHER_PAYMENT_HTTP_TIMEOUT_SEC=10 POLYWEATHER_PAYMENT_POLL_INTERVAL_SEC=4 POLYWEATHER_PAYMENT_MAX_WAIT_SEC=50 POLYWEATHER_PAYMENT_TELEGRAM_NOTIFY_ENABLED=true POLYWEATHER_PAYMENT_POINTS_ENABLED=true POLYWEATHER_PAYMENT_POINTS_PER_USDC=500 POLYWEATHER_PAYMENT_POINTS_MAX_DISCOUNT_USDC=3 POLYWEATHER_PAYMENT_POINTS_MAX_DISCOUNT_USDC_BY_PLAN_JSON={"pro_monthly":3,"pro_quarterly":8} POLYWEATHER_PAYMENT_ALLOWED_PLAN_CODES=pro_monthly,pro_quarterly POLYWEATHER_PAYMENT_PLAN_CATALOG_JSON= POLYMARKET_SIGNAL_EDGE_PCT=2 # Polygon watcher POLYGON_WALLET_WATCH_ENABLED=false POLYGON_RPC_URL=https://polygon-rpc.com POLYGON_WALLET_WATCH_ADDRESSES= POLYGON_WALLET_WATCH_INTERVAL_SEC=8 POLYGON_WALLET_WATCH_CONFIRMATIONS=2 POLYGON_WALLET_WATCH_MAX_BLOCKS_PER_CYCLE=30 POLYGON_WALLET_WATCH_SEEN_TTL_SEC=604800 POLYGON_WALLET_WATCH_RPC_TIMEOUT_SEC=10 POLYGON_WALLET_WATCH_TX_BASE=https://polygonscan.com/tx POLYGON_WALLET_WATCH_ADDR_BASE=https://polygonscan.com/address POLYGON_WALLET_WATCH_POLYMARKET_ONLY=true POLYGON_WALLET_WATCH_INCLUDE_DEFAULT_PM_CONTRACTS=true POLYGON_WALLET_WATCH_POLYMARKET_CONTRACTS= ######################################## # 8) Optional proxies ######################################## HTTPS_PROXY= HTTP_PROXY= POLYWEATHER_TELEGRAM_JOIN_INELIGIBLE_ACTION=decline