Skip to content

qbit-guard logo Environment Variables Reference

Complete reference of all environment variables supported by qbit-guard, organized by feature area.


Essential qBittorrent Connection

VariableDefaultDescription
QBIT_HOSThttp://127.0.0.1:8080qBittorrent WebUI URL
QBIT_USERadminqBittorrent WebUI username
QBIT_PASSadminadminqBittorrent WebUI password
QBIT_ALLOWED_CATEGORIESradarr,tv-sonarrComma-separated list of categories to process
QBIT_DELETE_FILEStrueDelete files when removing torrents
QBIT_IGNORE_TLS0Set to 1 to ignore SSL certificate errors
QBIT_DRY_RUN0Set to 1 for testing mode (no actual deletions)

Container Watcher (Polling Mode)

VariableDefaultDescription
WATCH_POLL_SECONDS3.0How often to check qBittorrent for new torrents (seconds)
WATCH_PROCESS_EXISTING_AT_START0Process existing torrents when container starts (0 or 1)
WATCH_RESCAN_KEYWORDrescanKeyword in category/tags to force reprocessing

Sonarr Integration (Pre-air Gate)

VariableDefaultDescription
ENABLE_PREAIR_CHECK1Enable pre-air checking (0 or 1)
SONARR_URLhttp://127.0.0.1:8989Sonarr base URL
SONARR_APIKEY-Sonarr API key
SONARR_CATEGORIEStv-sonarrCategories to apply pre-air checks to
EARLY_GRACE_HOURS6Allow releases this many hours before air date
EARLY_HARD_LIMIT_HOURS72Block releases more than this many hours early
WHITELIST_OVERRIDES_HARD_LIMIT0Let whitelisted releases bypass hard limit (0 or 1)
EARLY_WHITELIST_GROUPS-Comma-separated list of trusted release groups
EARLY_WHITELIST_INDEXERS-Comma-separated list of trusted indexers
EARLY_WHITELIST_TRACKERS-Comma-separated list of trusted trackers
RESUME_IF_NO_HISTORY1Proceed if Sonarr history not found (0 or 1)
SONARR_TIMEOUT_SEC45HTTP timeout for Sonarr API calls
SONARR_RETRIES3Retry attempts for Sonarr operations

Radarr Integration

VariableDefaultDescription
RADARR_URLhttp://127.0.0.1:7878Radarr base URL
RADARR_APIKEY-Radarr API key
RADARR_CATEGORIESradarrCategories to apply Radarr blocklisting to
RADARR_TIMEOUT_SEC45HTTP timeout for Radarr API calls
RADARR_RETRIES3Retry attempts for Radarr operations

Internet Cross-Verification

VariableDefaultDescription
INTERNET_CHECK_PROVIDERtvmazeProvider selection: off, tvmaze, tvdb, or both

TVmaze Settings

VariableDefaultDescription
TVMAZE_BASEhttps://api.tvmaze.comTVmaze API base URL
TVMAZE_TIMEOUT_SEC8HTTP timeout for TVmaze API calls

TheTVDB Settings

VariableDefaultDescription
TVDB_BASEhttps://api4.thetvdb.com/v4TheTVDB API base URL
TVDB_APIKEY-TheTVDB API key (required for TVDB)
TVDB_PIN-TheTVDB PIN (optional)
TVDB_LANGUAGEengLanguage code for TheTVDB
TVDB_ORDERdefaultEpisode order: default or official
TVDB_TIMEOUT_SEC8HTTP timeout for TheTVDB API calls
TVDB_BEARER-Reuse existing bearer token (optional)

ISO/BDMV Cleanup

VariableDefaultDescription
ENABLE_ISO_CHECK1Enable ISO/disc image cleanup (0 or 1)
MIN_KEEPABLE_VIDEO_MB50Minimum size for video files to keep (MB)
METADATA_POLL_INTERVAL1.5Seconds between file list checks during metadata fetching
METADATA_MAX_WAIT_SEC0Max wait for metadata resolution (0 = infinite)
METADATA_DOWNLOAD_BUDGET_BYTES0Max bytes to download during metadata wait (0 = no limit)

Extension Policy

VariableDefaultDescription
GUARD_EXT_STRATEGYblockExtension strategy: block or allow
GUARD_ALLOWED_EXTS-Comma-separated list of allowed extensions (for allow mode)
GUARD_BLOCKED_EXTS-Comma-separated list of blocked extensions (overrides defaults in block mode)
GUARD_EXT_DELETE_IF_ALL_BLOCKED1Delete only if all files are disallowed (0 or 1)
GUARD_EXT_DELETE_IF_ANY_BLOCKED0Delete if any file is disallowed (0 or 1)
GUARD_EXT_VIOLATION_TAGtrash:extTag applied to torrents deleted for extension violations
GUARD_DISC_EXTSiso,img,mdf,nrg,cue,binDisc image extensions
GUARD_EXTS_FILE-Path to JSON config file (optional)

Logging and Performance

VariableDefaultDescription
LOG_LEVELINFOLogging verbosity: INFO or DEBUG
USER_AGENTqbit-guard/2.0HTTP User-Agent string for API calls

Configuration by Use Case

Minimal Setup

Bash
1
2
3
4
5
# Only required when using containers (defaults work for localhost)
QBIT_HOST=http://qbittorrent:8080
QBIT_PASS=your_password

# Note: QBIT_USER, QBIT_ALLOWED_CATEGORIES, ENABLE_ISO_CHECK all have sensible defaults

Pre-air Gate Only

Bash
1
2
3
4
5
6
7
8
9
# qBittorrent connection (for containers)
QBIT_HOST=http://qbittorrent:8080
QBIT_PASS=your_password

# Sonarr pre-air checking - API key required
SONARR_URL=http://sonarr:8989
SONARR_APIKEY=your_sonarr_api_key

# Note: ENABLE_PREAIR_CHECK=1 by default, along with reasonable grace periods
Bash
# qBittorrent (for containers)
QBIT_HOST=http://qbittorrent:8080
QBIT_PASS=your_password

# Sonarr pre-air checking
SONARR_URL=http://sonarr:8989
SONARR_APIKEY=your_sonarr_api_key
EARLY_WHITELIST_GROUPS=trusted_group1,trusted_group2

# Radarr integration
RADARR_URL=http://radarr:7878
RADARR_APIKEY=your_radarr_api_key

# Optional overrides
MIN_KEEPABLE_VIDEO_MB=100
LOG_LEVEL=DEBUG

# Note: Many features enabled by default - ISO cleanup, pre-air checks, TVmaze verification

High Performance Setup

Bash
# Faster polling
WATCH_POLL_SECONDS=1.0

# Increased timeouts for slow networks
SONARR_TIMEOUT_SEC=90
RADARR_TIMEOUT_SEC=90
TVMAZE_TIMEOUT_SEC=15

# Process existing torrents on startup
WATCH_PROCESS_EXISTING_AT_START=1

# Metadata limits for large torrents
METADATA_MAX_WAIT_SEC=300
METADATA_DOWNLOAD_BUDGET_BYTES=104857600  # 100MB

Default Values Summary

Variables with meaningful defaults that you may not need to set:

VariableDefaultNotes
QBIT_HOSThttp://127.0.0.1:8080Usually needs to be changed for containers
QBIT_USERadminMost qBittorrent installations
QBIT_PASSadminadminDefault qBittorrent password
QBIT_ALLOWED_CATEGORIESradarr,tv-sonarrCommon categories for *arr services
QBIT_DELETE_FILEStrueUsually desired behavior
ENABLE_PREAIR_CHECK1Pre-air checking enabled by default
SONARR_URLhttp://127.0.0.1:8989Default Sonarr port
RADARR_URLhttp://127.0.0.1:7878Default Radarr port
ENABLE_ISO_CHECK1ISO cleanup enabled by default
INTERNET_CHECK_PROVIDERtvmazeTVmaze enabled by default (no API key needed)
WATCH_POLL_SECONDS3.0Good balance of responsiveness/resources
EARLY_GRACE_HOURS6Reasonable pre-air grace period
EARLY_HARD_LIMIT_HOURS72Prevents very early releases
MIN_KEEPABLE_VIDEO_MB50Filters out samples and extras
LOG_LEVELINFOChange to DEBUG for troubleshooting
USER_AGENTqbit-guard/2.0HTTP User-Agent for API calls

Next Steps