Files
telegram-bot-workers/wrangler.toml
kappa dab279c765 fix: security hardening and performance improvements
Security:
- Add token+secret auth to /setup-webhook and /webhook-info endpoints
- Disable /api/test in production environment (ENVIRONMENT=production)

Performance:
- Add retryWithBackoff to weather-tool (maxRetries: 2)
- Add KV caching to executeLookupDocs (1h TTL)

Code Quality:
- Centralize error messages in src/constants/messages.ts
- Update 5 files to use centralized error constants

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 17:35:51 +09:00

52 lines
2.0 KiB
TOML

name = "telegram-summary-bot"
main = "src/index.ts"
compatibility_date = "2024-01-01"
[ai]
binding = "AI"
[vars]
ENVIRONMENT = "production" # 환경 설정 (production | development)
SUMMARY_THRESHOLD = "20" # 프로필 업데이트 주기 (메시지 수)
MAX_SUMMARIES_PER_USER = "3" # 유지할 프로필 버전 수 (슬라이딩 윈도우)
N8N_WEBHOOK_URL = "https://n8n.anvil.it.com" # n8n 연동 (선택)
# Admin IDs moved to secrets (see bottom of file)
# API Endpoints
OPENAI_API_BASE = "https://gateway.ai.cloudflare.com/v1/d8e5997eb4040f8b489f09095c0f623c/telegram-bot/openai"
NAMECHEAP_API_URL = "https://namecheap-api.anvil.it.com"
WHOIS_API_URL = "https://whois-api-kappa-inoutercoms-projects.vercel.app"
CONTEXT7_API_BASE = "https://context7.com/api/v2"
BRAVE_API_BASE = "https://api.search.brave.com/res/v1"
WTTR_IN_URL = "https://wttr.in"
HOSTING_SITE_URL = "https://hosting.anvil.it.com"
[[d1_databases]]
binding = "DB"
database_name = "telegram-conversations"
database_id = "c285bb5b-888b-405d-b36f-475ae5aed20e"
[[kv_namespaces]]
binding = "RATE_LIMIT_KV"
id = "15bcdcbde94046fe936c89b2e7d85b64"
# Email Worker 설정 (SMS → 메일 수신)
# Cloudflare Dashboard에서 Email Routing 설정 필요:
# 1. Email > Email Routing > Routes
# 2. deposit@your-domain.com → Worker: telegram-summary-bot
# Cron Trigger: 매일 자정(KST) 실행 - 24시간 경과된 입금 대기 자동 취소
[triggers]
crons = ["0 15 * * *"] # UTC 15:00 = KST 00:00
# Secrets (wrangler secret put 으로 설정):
# - BOT_TOKEN: Telegram Bot Token
# - WEBHOOK_SECRET: Webhook 검증용 시크릿
# - OPENAI_API_KEY: OpenAI API 키
# - NAMECHEAP_API_KEY: namecheap-api 래퍼 인증 키 (도메인 추천용)
# - NAMECHEAP_API_KEY_INTERNAL: Namecheap API 키 (내부용)
# - BRAVE_API_KEY: Brave Search API 키
# - DEPOSIT_API_SECRET: Deposit API 인증 키 (namecheap-api 연동)
# - DOMAIN_OWNER_ID: 도메인 관리 권한 Telegram ID (보안상 secrets 권장)
# - DEPOSIT_ADMIN_ID: 예치금 관리 권한 Telegram ID (보안상 secrets 권장)