Skip to content

Configuration & Environment Variables ​

This document lists all environment variables required by the TeleDrive control API, worker processes, and the Cloudflare Edge Gateway.


1. Application Server Configuration ​

VariableTypeDefaultDescription
PORTNumber5000Port for the Node.js Express server
NODE_ENVStringdevelopmentEnvironment mode (development or production)
APP_URLStringhttp://localhost:5000Public backend base URL
FRONTEND_URLStringhttp://localhost:5173Allowed CORS origin for web app

2. Telegram MTProto Configuration ​

VariableTypeDescription
TELEGRAM_API_IDNumberYour Telegram Application API ID from my.telegram.org
TELEGRAM_API_HASHStringYour Telegram Application API Hash
TELEGRAM_BOT_TOKENStringBot token generated via @BotFather
TELEGRAM_STORAGE_CHAT_IDString / NumberPrivate channel or supergroup ID where chunks are persisted

3. Database & Caching Services ​

VariableTypeDefaultDescription
MONGODB_URIStringmongodb://localhost:27017/teledriveMongoDB connection string
REDIS_URLStringredis://localhost:6379Redis connection URI for BullMQ queues and locks

4. Cryptographic Secrets ​

Security Requirement

All secrets must be cryptographically random and at least 32 characters in length. Never commit these secrets to version control.

VariableTypeDescription
DOWNLOAD_GATEWAY_SECRETStringSecret key for HMAC-SHA-256 token generation and validation
DOWNLOAD_GATEWAY_ROTATION_SECRETStringSecondary key used during zero-downtime key rotation
INTERNAL_GATEWAY_SECRETStringShared header key between Cloudflare Worker and /internal/download-stream
DOWNLOAD_GATEWAY_URLStringPublic base URL of your Cloudflare Worker (e.g. https://download.example.com)

5. Concurrency & Performance Limits ​

VariableTypeDefaultDescription
CONCURRENT_DOWNLOADS_PER_USERNumber3Max concurrent active streams per individual user
GLOBAL_MAX_CONCURRENT_DOWNLOADSNumber50Max concurrent active streams across the origin node
MAX_FILE_SIZE_BYTESNumber2097152000Max file upload size (2 GB limit)

Released under the MIT License