Files
drive/.env.example
2026-10-18 23:48:22 +05:30

120 lines
4.9 KiB
Bash

# Copy to .env for local runs. On Heroku set these as Config Vars instead.
# Placeholder values only - never commit real secrets.
# ---------------------------------------------------------------- Telegram
# user = your own account (full history, needs login); bot = bot admin of the channel
TELEGRAM_MODE=user
# From https://my.telegram.org -> API development tools (needed in both modes)
TELEGRAM_API_ID=1234567
TELEGRAM_API_HASH=your_api_hash_here
# From @BotFather: admin command interface (required in bot mode, recommended in user mode)
TELEGRAM_BOT_TOKEN=123456789:replace-with-your-bot-token
# User mode on Heroku: output of `python main.py login --session-string`.
# Locally you can leave it empty and use `python main.py login` (session file).
TELEGRAM_SESSION_STRING=
# Numeric Telegram user IDs allowed to use the commands (comma-separated)
ADMIN_USER_IDS=111111111
# Chats that receive progress/notifications (default: ADMIN_USER_IDS)
NOTIFY_CHAT_IDS=
# @username, https://t.me/... link, or -100... numeric ID
SOURCE_CHANNEL_ID=@your_channel
# existing | new | both
PROCESS_MODE=both
START_MESSAGE_ID=1
# Optional ISO date: only messages on/after this date (e.g. 2024-01-31)
START_DATE=
INCLUDE_DOCUMENT_VIDEOS=true
# Optional comma-separated filters (case-insensitive)
FILTER_TOPICS=
FILTER_BATCHES=
# Bot mode history probing (bots cannot list history)
BOT_SCAN_MAX_EMPTY=200
BOT_SCAN_END_ID=
# Telegram flood waits shorter than this (seconds) are slept through automatically
FLOOD_SLEEP_THRESHOLD=60
SESSION_DIR=data/sessions
# ---------------------------------------------------------------- Google Drive
# oauth (personal Drive) | service_account (Shared Drive)
GOOGLE_AUTH_MODE=oauth
# drive.file (least privilege; bot only sees folders it created) | drive (full access)
GOOGLE_DRIVE_SCOPE=drive.file
# Local OAuth files (used by `python main.py drive-auth`)
GOOGLE_CLIENT_SECRETS_FILE=credentials/client_secret.json
GOOGLE_TOKEN_FILE=credentials/token.json
# Heroku / file-less alternatives (raw JSON or base64 JSON):
GOOGLE_OAUTH_TOKEN_JSON=
GOOGLE_SERVICE_ACCOUNT_JSON=
GOOGLE_SERVICE_ACCOUNT_FILE=
# Folder that will contain the topic folders (empty = top level of My Drive)
GOOGLE_DRIVE_ROOT_FOLDER_ID=
DRIVE_SHARED_DRIVE_ID=
# none (private, default) | anyone_with_link
DRIVE_SHARE_MODE=none
# Multiple of 256KB; one chunk is held in memory at a time
UPLOAD_CHUNK_SIZE=16MB
# ---------------------------------------------------------------- Organisation & naming
BATCH_SUBFOLDERS_ENABLED=false
FALLBACK_TOPIC_FOLDER=Uncategorized
FALLBACK_BATCH_FOLDER=Unknown Batch
# suffix_number | suffix_message_id | skip | fail (never overwrites)
DUPLICATE_POLICY=suffix_number
# Reuse an existing same-name file in the folder when size and MD5 match
REUSE_IDENTICAL_FILES=true
# skip | upload : the same Telegram media posted again under a new message ID
DUPLICATE_MEDIA_POLICY=skip
# fallback (Telegram file name / telegram_<id>) | fail
MISSING_TITLE_POLICY=fallback
# keep | append : when the Title extension disagrees with the real container
EXTENSION_MISMATCH_POLICY=keep
# Replace characters Windows cannot store (<>:"|?*)
STRICT_FILENAMES=false
# Optional persistent sequence number prefix, e.g. "001 - Class 01.mp4"
SEQUENCE_PREFIX_ENABLED=false
SEQUENCE_PREFIX_FORMAT="{seq:03d} - "
# ---------------------------------------------------------------- Storage
# PostgreSQL (required on Heroku; Heroku Postgres sets it automatically)
DATABASE_URL=
# SQLite file used when DATABASE_URL is empty (local development)
DATABASE_PATH=data/bot.db
# Only set to true if you accept losing all progress on every Heroku restart
ALLOW_EPHEMERAL_DATABASE=false
DATA_DIR=data
DOWNLOAD_DIR=downloads
LOG_DIR=logs
# 0 = unlimited
MAX_TEMP_STORAGE=0
MIN_FREE_DISK_SPACE=1GB
KEEP_LOCAL_FILES=false
# Keep the local file of a video that FAILED (default: delete it; it can be downloaded again)
KEEP_FAILED_DOWNLOADS=false
# Seconds between sweeps that delete abandoned temp files (0 = only at startup / when disk is low)
TEMP_CLEANUP_INTERVAL=3600
COMPUTE_SHA256=true
# ---------------------------------------------------------------- Processing
MAX_RETRIES=4
RETRY_DELAY=30
RETRY_MAX_DELAY=1800
# Retries of a single HTTP request inside one attempt
HTTP_RETRIES=5
PROCESSING_DELAY=2
# true = halt the whole queue when any video fails permanently
STRICT_STOP=false
# true = start processing at every boot (otherwise /run; then remembered across restarts)
AUTO_START=false
# Seconds to wait for another worker to release the queue lock (default 0 locally, 90 on Heroku)
INSTANCE_LOCK_WAIT=
PROGRESS_INTERVAL=10
# ---------------------------------------------------------------- /upload tasks
# Minutes before an unfinished /upload setup (waiting for links or /confirm) expires
UPLOAD_SETUP_TIMEOUT=30
# Largest allowed range (end - start + 1) for one task
UPLOAD_MAX_RANGE=5000
# true = links must point to SOURCE_CHANNEL_ID; false = any channel the Telegram account/bot can access
UPLOAD_RESTRICT_TO_SOURCE_CHANNEL=true
LOG_LEVEL=info