Complete guide to all FilesLink environment variables.
# Required
BOT_TOKEN= # Telegram bot token
STORAGE_CHANNEL_ID=- # Channel ID for storage
# Server
SERVER_PORT=8080
APP_FILE_DOMAIN=http://localhost:8080/files
# Telegram API
TELEGRAM_API_URL=https://api.telegram.org
TELEGRAM_LOCAL=false
TELEGRAM_API_ID= # From my.telegram.org
TELEGRAM_API_HASH= # From my.telegram.org
# Optional
RUST_LOG=info
ENABLE_FILES_ROUTE=false
FILESLINK_PIPE_PATH=/tmp/fileslink.pipeYour Telegram bot token from @BotFather.
- Format:
123456789:ABC-DEF1234ghIkl-zyx57W2v1u123ew11 - Example:
BOT_TOKEN=123456789:abcdefghijklmnop
How to get:
- Message @BotFather
- Send
/newbot - Follow instructions
- Copy token provided
###STORAGE_CHANNEL_ID`
ID of your private Telegram channel where files are stored.
- Format:
-1001234567890(always starts with-100) - Example:
STORAGE_CHANNEL_ID=-1001234567890
How to get:
- Create private channel
- Add bot as admin
- Forward message to @userinfobot
- Copy the channel ID
See Telegram Setup Guide for details.
Port where the application listens.
- Default:
8080 - Example:
SERVER_PORT=8080 - Note: Render/Railway use port 8080 by default
Public URL where files are accessible. Used to generate download links.
- Default:
http://localhost:8080/files - Local:
http://localhost:8080/files - Production:
https://yourdomain.com/files - Railway:
https://yourapp.up.railway.app/files - Render:
https://yourapp.onrender.com/files
Important: Must end with /files
Telegram Bot API server URL.
- Official API:
https://api.telegram.org - Local (Docker):
http://nginx:80orhttp://localhost:8088 - Default:
https://api.telegram.org
When to use local API:
- Large files (>20MB)
- High volume uploads
- Need caching
When to use official API:
- Cloud hosting (Render, Railway, Fly.io)
- Simple deployments
- No local storage
Whether using local Telegram Bot API server.
- Values:
trueorfalse - Default:
false - Set to
truewhen using local API in Docker - Set to
falsefor official API or cloud hosting
Your Telegram API ID from my.telegram.org.
- Required for: Local Telegram Bot API server
- Optional for: Official API
- Format: Integer
- Example:
TELEGRAM_API_ID=1234567
Your Telegram API hash from my.telegram.org.
- Required for: Local Telegram Bot API server
- Optional for: Official API
- Format: String (32 characters)
- Example:
TELEGRAM_API_HASH=abcdef1234567890abcdef1234567890
Application log level.
- Default:
info - Values:
error,warn,info,debug,trace - Production: Use
warnorerror - Development: Use
infoordebug - Example:
RUST_LOG=info
Enable /files endpoint to list all files.
- Default:
false - Values:
trueorfalse - Warning: Not recommended for production (security risk)
- Use case: Development/debugging only
Path to FIFO (named pipe) for CLI communication.
- Default:
/tmp/fileslink.pipe - Docker:
/app/fileslink.pipe - Example:
FILESLINK_PIPE_PATH=/tmp/fileslink.pipe
Note: CLI uses this path. Must match between server and CLI.
BOT_TOKEN=123456789:abcdefghijklmnop
STORAGE_CHANNEL_ID=-1001234567890
SERVER_PORT=8080
APP_FILE_DOMAIN=http://localhost:8080/files
TELEGRAM_API_URL=http://nginx:80
TELEGRAM_LOCAL=true
TELEGRAM_API_ID=1234567
TELEGRAM_API_HASH=abcdef1234567890abcdef1234567890
RUST_LOG=info
FILESLINK_PIPE_PATH=/app/fileslink.pipeBOT_TOKEN=123456789:abcdefghijklmnop
STORAGE_CHANNEL_ID=-1001234567890
SERVER_PORT=8080
APP_FILE_DOMAIN=https://yourapp.onrender.com/files
TELEGRAM_API_URL=https://api.telegram.org
TELEGRAM_LOCAL=false
TELEGRAM_API_ID=1234567
TELEGRAM_API_HASH=abcdef1234567890abcdef1234567890
RUST_LOG=warn
FILESLINK_PIPE_PATH=/app/fileslink.pipeBOT_TOKEN=123456789:abcdefghijklmnop
STORAGE_CHANNEL_ID=-1001234567890
SERVER_PORT=8080
APP_FILE_DOMAIN=https://files.yourdomain.com/files
TELEGRAM_API_URL=https://api.telegram.org
TELEGRAM_LOCAL=false
TELEGRAM_API_ID=1234567
TELEGRAM_API_HASH=abcdef1234567890abcdef1234567890
RUST_LOG=warn
ENABLE_FILES_ROUTE=false
FILESLINK_PIPE_PATH=/app/fileslink.pipe# View environment
docker compose config
# Test connection
docker compose logs fileslink-app❌ Wrong channel ID format
STORAGE_CHANNEL_ID=1234567890 # Missing -100 prefix✅ Correct format
STORAGE_CHANNEL_ID=-1001234567890❌ Wrong domain format
APP_FILE_DOMAIN=http://localhost:8080 # Missing /files✅ Correct format
APP_FILE_DOMAIN=http://localhost:8080/files- Never commit
.env- Add to.gitignore - Use environment secrets on cloud platforms
- Rotate tokens regularly
- Use HTTPS in production
- Restrict
ENABLE_FILES_ROUTEto dev only