Files
TeleUploader/.env.example
T
asepharyana 24dfb1c6b1
Build & Deploy (Nix) / build-and-deploy (push) Successful in 56s
fix: fail-fast guard TELEGRAM_CHUNK_SIZE_BYTES <= 19MB (Telegram getFile limit 20MB)
Chunk parts > 19MB are stored to Telegram but getFile cannot resolve files over 20MB ('Bad Request: file is too big'), making every part undownloadable (prod bug 2026-08-01: 48MB chunk -> download 500).

- src/env.ts: reject TELEGRAM_CHUNK_SIZE_BYTES > 19922944 at startup (log error + throw), default changed 20MB -> 19MB
- src/shared/utils/validation.ts: TELEGRAM_CHUNK_SIZE_MAX_BYTES constant; asSafeChunkSize now enforces the max at runtime (covers S3 multipart parts too)
- test/env.test.ts: unit tests + subprocess fail-fast tests (48MB rejected, 19MB accepted)
- test/helpers/setup-env.ts: pin safe chunk size so a stale .env can't break the suite
- .env.example + CLAUDE.md: document the 20MB getFile limit
2026-08-01 13:06:42 +07:00

29 lines
1.0 KiB
Bash

BOT_TOKENS=isi_token_bot_1,isi_token_bot_2,isi_token_bot_3
STORAGE_CHANNEL_ID=-1001234567890
BASE_URL=https://tele.asepharyana.my.id
DATABASE_URL=postgresql://user:password@localhost:5432/telegram_uploader
PORT=3000
NODE_ENV=production
LOG_LEVEL=info
RATE_LIMIT_WINDOW_MS=60000
RATE_LIMIT_MAX_REQUESTS=30
# TRUST_PROXY=true # Uncomment when behind reverse proxy (Traefik, Nginx) for correct client IP detection
# S3-compatible API credentials
# S3_ACCESS_KEY=filedrop-admin
# S3_SECRET_KEY=your-secret-key-here
# S3_DEFAULT_REGION=us-east-1
# S3_VHOST_DOMAINS=upload.asepharyana.my.id,upload.asepharyana.web.id
# Telegram-safe internal chunking for large stored files
# Telegram getFile download limit is 20 MB; guard rejects > 19922944 (19 MB)
# TELEGRAM_CHUNK_SIZE_BYTES=19922944
# COMPRESS_CHUNKED_UPLOADS=true
# CHUNK_COMPRESSION_MIN_SIZE_BYTES=4096
# Web dashboard/API auth. If empty, dashboard remains public.
ADMIN_API_TOKEN=
# Optional session cookie settings
# SESSION_COOKIE_NAME=tu_session
# SESSION_COOKIE_MAX_AGE_SECONDS=86400