forked from g0ldyy/comet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.env-sample
More file actions
513 lines (441 loc) · 29.2 KB
/
Copy path.env-sample
File metadata and controls
513 lines (441 loc) · 29.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
#=================================================#
# ██████╗ ██████╗ ███╗ ███╗███████╗████████╗ #
# ██╔════╝██╔═══██╗████╗ ████║██╔════╝╚══██╔══╝ #
# ██║ ██║ ██║██╔████╔██║█████╗ ██║ #
# ██║ ██║ ██║██║╚██╔╝██║██╔══╝ ██║ #
# ╚██████╗╚██████╔╝██║ ╚═╝ ██║███████╗ ██║ #
# ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ #
#=================================================#
# Thank you for using Comet! 🚀 #
#=================================================#
# ⚠️ IMPORTANT: DO NOT copy the entire content of this file to your .env file.
# Only copy and modify the variables you need to change.
# The default values shown in this file are automatically loaded by Comet.
# ============================== #
# Stremio Add-on Configuration #
# ============================== #
ADDON_ID=stremio.comet.fast
ADDON_NAME=Comet
# ============================== #
# FastAPI Server Configuration #
# ============================== #
FASTAPI_HOST=0.0.0.0
FASTAPI_PORT=8000
FASTAPI_WORKERS=1 # DO NOT change this if you don't know what you are doing. Setting this to -1 will spawn a worker for each CPU core, which can consume several GBs of RAM and cause high CPU usage.
USE_GUNICORN=True # Will use uvicorn if False or if on Windows
GUNICORN_PRELOAD_APP=True # Set to False to start workers without preloading the app (reduces startup cost but requires schema to exist)
EXECUTOR_MAX_WORKERS=1 # Max workers for ProcessPoolExecutor (handles CPU-intensive tasks like RTN parsing). Recommended: 1. Do not exceed 4 unless you have a high-end machine.
# ============================== #
# Playback Settings #
# ============================== #
PUBLIC_BASE_URL= # Optional: force playback URLs to use this public base (e.g. https://comet.example.com). Leave empty to use the request host.
# ============================== #
# Dashboard Settings #
# ============================== #
ADMIN_DASHBOARD_PASSWORD=CHANGE_ME # The password to access the dashboard (Randomly generated if not set)
ADMIN_DASHBOARD_SESSION_TTL=86400 # Session lifetime for the admin dashboard login cookie (seconds)
PUBLIC_METRICS_API=False # Set to True to allow public access to the metrics API (/admin/api/metrics)
# ============================== #
# Configuration Page Security #
# ============================== #
CONFIGURE_PAGE_PASSWORD= # Optional: protect /configure and /{config}/configure with a password (disabled if empty)
CONFIGURE_PAGE_SESSION_TTL=86400 # Session lifetime for the configuration page login cookie (seconds)
PUBLIC_API_TOKEN= # Optional: token used in the Stremio API prefix /s/<token>. If empty and CONFIGURE_PAGE_PASSWORD is set, Comet auto-generates one.
PUBLIC_API_TOKEN_FILE=data/public_api_token.txt # File used to persist the auto-generated PUBLIC_API_TOKEN outside the database
# ============================== #
# Database Configuration #
# ============================== #
# ⚠️ WARNING: SQLite has POOR CONCURRENCY support and should ONLY be used for development/testing!
# SQLite cannot handle multiple concurrent writers well, leading to:
# - "database is locked" errors with multiple workers
# - Performance issues with background scraper
# - Data corruption risks under heavy load
# For production deployments, use PostgreSQL!
DATABASE_TYPE=postgresql # Options: sqlite, postgresql - Use postgresql for production, sqlite for development only
DATABASE_FORCE_IPV4_RESOLUTION=False # Set to True to force resolving the database hostname to an IPv4 address (fix for asyncpg on ARM64 - only if you are using postgresql)
DATABASE_URL=comet:comet@postgres:5432/comet # For PostgreSQL (user:password@host:port/database)
DATABASE_PATH=data/comet.db # Only relevant for SQLite (development only)
DATABASE_BATCH_SIZE=20000 # The batch size for the database import and export operations
DATABASE_READ_REPLICA_URLS='' # Optional JSON array of PostgreSQL read-only URLs, e.g. '["user:pass@replica-1/db", "user:pass@replica-2/db"]'
DATABASE_STARTUP_CLEANUP_INTERVAL=3600 # Minimum seconds between heavy startup cleanup sweeps (0=every start, -1=disable)
# ============================== #
# Cache Settings (Seconds) #
# ============================== #
METADATA_CACHE_TTL=2592000 # 30 days
# TORRENT_CACHE_TTL: Controls when torrents are PERMANENTLY REMOVED from the database.
# Set to -1 to disable automatic removal (torrents stay forever).
TORRENT_CACHE_TTL=2592000 # 30 days
# LIVE_TORRENT_CACHE_TTL: Controls when a NEW LIVE SEARCH is triggered.
# If the cache is older than this value, Comet performs a new search to find new torrents.
# Important: Old cached torrents are ALWAYS included in results, this only controls refresh frequency.
# Set to -1 to never trigger new searches (always use existing cache only).
LIVE_TORRENT_CACHE_TTL=604800 # 7 days
DEBRID_CACHE_TTL=86400 # 1 day
DEBRID_CACHE_CHECK_RATIO=0.0 # Minimum ratio (0.5 = 5%) of cached torrents/total torrents required to skip re-checking availability on the debrid service.
METRICS_CACHE_TTL=60 # 1 minute
SCRAPE_LOCK_TTL=300 # 5 minutes - Duration for distributed scraping locks
SCRAPE_WAIT_TIMEOUT=30 # 30 seconds - Max time to wait for other instance to complete scraping
# ======================================================= #
# Background Scraper #
# Zilean and no-ratelimit indexers/scrapers recommended! #
# PostgreSQL recommended for high worker count! #
# ======================================================= #
BACKGROUND_SCRAPER_ENABLED=False # Auto-start background scraper when Comet starts (manual start from admin UI still possible if False)
BACKGROUND_SCRAPER_CONCURRENT_WORKERS=1 # Number of concurrent workers for scraping (adjust depending on whether you are often ratelimited by scrapers)
BACKGROUND_SCRAPER_INTERVAL=3600 # Interval between scraping cycles in seconds
BACKGROUND_SCRAPER_MAX_MOVIES_PER_RUN=100 # Maximum number of movies to scrape per run
BACKGROUND_SCRAPER_MAX_SERIES_PER_RUN=100 # Maximum number of series to scrape per run
BACKGROUND_SCRAPER_SUCCESS_TTL=604800 # Successful scrape cooldown before re-scraping same media (seconds)
BACKGROUND_SCRAPER_FAILURE_BASE_BACKOFF=3600 # Initial retry delay for failed scrapes (seconds)
BACKGROUND_SCRAPER_FAILURE_MAX_BACKOFF=604800 # Maximum retry delay for failed scrapes (seconds)
BACKGROUND_SCRAPER_MAX_RETRIES=6 # Max consecutive failed attempts before marking item as dead
BACKGROUND_SCRAPER_RUN_TIME_BUDGET=1800 # Soft runtime budget for one run/cycle (seconds)
BACKGROUND_SCRAPER_DISCOVERY_MULTIPLIER=3 # Discover this multiplier * planned items each cycle
BACKGROUND_SCRAPER_MAX_EPISODES_PER_SERIES_PER_RUN=25 # Cap episodes scraped per series in one cycle
BACKGROUND_SCRAPER_EPISODE_REFRESH_TTL=21600 # Refresh known series episodes from Cinemeta when older than this TTL (seconds)
BACKGROUND_SCRAPER_ENABLE_DEMAND_PRIORITY=True # Prioritize items recently requested by users
BACKGROUND_SCRAPER_DEMAND_LOOKBACK=86400 # Recency window for demand boost from first_searches (seconds)
BACKGROUND_SCRAPER_DEFER_COOLDOWN=300 # Cooldown applied when item is deferred due run budget/cancel (seconds)
BACKGROUND_SCRAPER_MIN_PRIORITY_SCORE=0.0 # Skip low-priority discovered items below this threshold (unless recently demanded)
BACKGROUND_SCRAPER_PRIORITY_DECAY_ON_MISS=0.9 # Multiply item priority by this factor on misses (0<value<=1)
BACKGROUND_SCRAPER_QUEUE_LOW_WATERMARK=10000 # Resume discovery only when queue drops to or below this level
BACKGROUND_SCRAPER_QUEUE_HIGH_WATERMARK=20000 # Pause discovery when queue reaches this level (hysteresis with LOW)
BACKGROUND_SCRAPER_QUEUE_HARD_CAP=30000 # Safety cap: force discovery pause when queue reaches this level
BACKGROUND_SCRAPER_ALERT_FAIL_RATE=0.7 # Degrade health when 24h fail rate exceeds this ratio
BACKGROUND_SCRAPER_ALERT_QUEUE_AGE=86400 # Degrade health when oldest queued item age exceeds this (seconds)
BACKGROUND_SCRAPER_RUN_RETENTION_DAYS=30 # Retention for run history table
CATALOG_TIMEOUT=30 # Max time to fetch catalog pages (seconds)
# ============================== #
# Anime Mapping Configuration #
# ============================== #
# Anime Mapping is used to match IMDb/Kitsu IDs to Anime specific IDs (AniList, MAL, Kitsu, etc.) to retrieve title aliases.
# This greatly improves title matching performances for anime content by using accurate alternative titles.
ANIME_MAPPING_ENABLED=True
ANIME_MAPPING_REFRESH_INTERVAL=432000 # Seconds between background anime mapping refreshes when using database cache (<=0 disables)
# ============================== #
# Networking & Proxy Configuration #
# ============================== #
GLOBAL_PROXY_URL= # Global proxy for all outbound requests (e.g. http://user:pass@host:port)
PROXY_ETHOS=always # always: use proxy for everything; on_failure: retry with proxy if direct fails (not recommended); never: never use proxy (unless specific scraper override)
# Scraper specific proxies can be set using [SCRAPERNAME]_PROXY_URL
# Example: TORRENTIO_PROXY_URL=http://...
RATELIMIT_MAX_RETRIES=3 # Maximum number of retries for 429 Too Many Requests errors. Set to 0 to disable retries.
RATELIMIT_RETRY_BASE_DELAY=1.0 # Base delay in seconds for exponential backoff (e.g., 1.0 -> 1s, 2s, 4s, 8s...)
# ============================== #
# Jackett & Prowlarr Settings #
# ============================== #
# Jackett Configuration
SCRAPE_JACKETT=False # Context mode: live, background, both, false
JACKETT_URL=http://127.0.0.1:9117
JACKETT_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
JACKETT_INDEXERS=[] # Leave empty to automatically use all configured/healthy indexers. Or specify a list of indexer IDs to use (e.g. '["oxtorrent", "torrent9"]').
# Prowlarr Configuration
SCRAPE_PROWLARR=False # Context mode: live, background, both, false
PROWLARR_URL=http://127.0.0.1:9696
PROWLARR_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
PROWLARR_INDEXERS=[] # Leave empty to automatically use all configured/healthy indexers. Or specify a list of indexer IDs.
# Shared Settings
INDEXER_MANAGER_TIMEOUT=30 # Max time to get search results (seconds) - Shared by both
INDEXER_MANAGER_WAIT_TIMEOUT=30 # Max time to wait for the indexer manager to initialize (seconds)
INDEXER_MANAGER_UPDATE_INTERVAL=900 # Time in seconds between indexer updates (default: 900s / 15m)
# ============================== #
# Torrent Settings #
# ============================== #
GET_TORRENT_TIMEOUT=5 # Max time to download .torrent file (seconds)
DOWNLOAD_TORRENT_FILES=False # Enable torrent file retrieval from magnet link
MAGNET_RESOLVE_TIMEOUT=60 # Max time to resolve a magnet link (seconds)
DOWNLOAD_GENERIC_TRACKERS=False # Enable downloading generic trackers list at startup (for scraped torrents without trackers, doesn't work well most of the time)
# ============================== #
# Scraping Configuration #
# ============================== #
# Multi-Instance Scraping Support:
# - Single URL: Use a simple string for one instance (default behavior)
# - Multiple URLs: Use JSON array format for multiple instances
# - Example single: COMET_URL=https://comet.feels.legal
# - Example multi: COMET_URL='["https://comet1.example.com", "https://comet2.example.com"]'
#
# Scraper Context Modes:
# Each SCRAPE_* setting can control when scrapers are used:
# - true/both: Used for live scraping AND background scraping (default)
# - live: Only used for live scraping (when users request content)
# - background: Only used for background scraping (automatic content pre-caching)
# - false: Completely disabled
#
# Examples:
# SCRAPE_COMET=both # Used for both live and background scraping
# SCRAPE_TORRENTIO=live # Fast live scraping only
# SCRAPE_ZILEAN=background # Background cache building only
# SCRAPE_NYAA=false # Completely disabled
# SCRAPE_JACKETT=live # Jackett for live scraping only
# SCRAPE_PROWLARR=background # Prowlarr for background scraping only
SCRAPE_COMET=False
COMET_URL=https://comet.feels.legal
# Multi-instance example:
# COMET_URL='["https://comet1.example.com", "https://comet2.example.com"]'
COMET_CLEAN_TRACKER=False # If True, Comet will clean the tracker list to only show the last Comet instance and the original tracker (e.g. Comet|Comet|Nyaa -> Comet|Nyaa) in results
SCRAPE_NYAA=False
NYAA_ANIME_ONLY=True # Only scrape Nyaa if the content is anime
NYAA_MAX_CONCURRENT_PAGES=5 # Maximum number of concurrent requests to Nyaa (consider reducing if you are often ratelimited by Nyaa)
SCRAPE_ANIMETOSHO=False
ANIMETOSHO_ANIME_ONLY=True # Only scrape AnimeTosho if the content is anime
ANIMETOSHO_MAX_CONCURRENT_PAGES=10 # Maximum number of concurrent requests to AnimeTosho (consider reducing if you are often ratelimited by AnimeTosho)
SCRAPE_SEADEX=False # requires ANIME_MAPPING_ENABLED to be True
SEADEX_ANIME_ONLY=True # Only scrape SeaDex if the content is anime
SCRAPE_NEKOBT=False
NEKOBT_ANIME_ONLY=True # Only scrape NekoBT if the content is anime
SCRAPE_ZILEAN=False
ZILEAN_URL=https://zileanfortheweebs.midnightignite.me
# Multi-instance example:
# ZILEAN_URL='["https://zilean1.example.com", "https://zilean2.example.com"]'
SCRAPE_STREMTHRU=False
STREMTHRU_SCRAPE_URL=https://stremthru.13377001.xyz
# Multi-instance example:
# STREMTHRU_SCRAPE_URL='["https://stremthru1.example.com", "https://stremthru2.example.com"]'
# Debrid Media Manager (DMM) Scraper & Ingester
# SCRAPE_DMM: Choose when to search the LOCAL DMM cache (migrated from hashlists)
SCRAPE_DMM=False
# DMM Ingester: Automatically downloads and indexes DMM hashlists into your local database.
# This is REQUIRED for SCRAPE_DMM to return results.
DMM_INGEST_ENABLED=False
DMM_INGEST_INTERVAL=86400 # Seconds between ingestion cycles (default: 1 day)
DMM_INGEST_CONCURRENT_WORKERS=4 # Number of concurrent workers for DMM ingestion. Increase this if you have a powerful CPU. Make sure EXECUTOR_MAX_WORKERS is set to at least this value.
DMM_INGEST_BATCH_SIZE=100 # Number of files to process per batch. Increase this for better throughput if your CPU can handle it.
SCRAPE_BITMAGNET=False
BITMAGNET_URL=https://bitmagnetfortheweebs.midnightignite.me
BITMAGNET_MAX_CONCURRENT_PAGES=5
BITMAGNET_MAX_OFFSET=15000 # Maximum number of entries to scrape
# Multi-instance example:
# BITMAGNET_URL='["https://bitmagnet1.example.com", "https://bitmagnet2.example.com"]'
SCRAPE_TORRENTIO=False
TORRENTIO_URL=https://torrentio.strem.fun
# Multi-instance example:
# TORRENTIO_URL='["https://torrentio.strem.fun", "https://custom-torrentio.example.com"]'
SCRAPE_MEDIAFUSION=False
MEDIAFUSION_URL=https://mediafusion.elfhosted.com
MEDIAFUSION_API_PASSWORD= # API password for MediaFusion instances that require authentication
MEDIAFUSION_LIVE_SEARCH=True
# Multi-instance MediaFusion examples:
# MEDIAFUSION_URL='["https://mediafusion1.example.com", "https://mediafusion2.example.com"]'
# MEDIAFUSION_API_PASSWORD='["password1", "password2"]' # One password per URL in same order
# MEDIAFUSION_API_PASSWORD=single_password # Same password for all instances
# MEDIAFUSION_API_PASSWORD= # No password for any instance
SCRAPE_AIOSTREAMS=False
AIOSTREAMS_URL=https://aio.example.com
AIOSTREAMS_USER_UUID_AND_PASSWORD=user_uuid:password
# Multi-instance AIOStreams examples:
# AIOSTREAMS_URL='["https://aio1.example.com", "https://aio2.example.com"]'
# AIOSTREAMS_USER_UUID_AND_PASSWORD='["uuid1:password1", "uuid2:password2"]' # One credential per URL in same order
# AIOSTREAMS_USER_UUID_AND_PASSWORD=single_uuid:single_password # Same credentials for all instances
SCRAPE_JACKETTIO=False
JACKETTIO_URL=https://jackettio.example.com # Full manifest URL without /manifest.json at the end
# Multi-instance example:
# JACKETTIO_URL='["https://jackettio1.example.com", "https://jackettio2.example.com"]'
SCRAPE_DEBRIDIO=False
DEBRIDIO_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
DEBRIDIO_PROVIDER=realdebrid # alldebrid, debrider, debridlink, easydebrid, premiumize, realdebrid, torbox
DEBRIDIO_PROVIDER_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
SCRAPE_TORBOX=False
TORBOX_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
SCRAPE_TORRENTSDB=False
SCRAPE_PEERFLIX=False
# ============================== #
# Debrid Stream Proxy Settings #
# ============================== #
PROXY_DEBRID_STREAM=False
PROXY_DEBRID_STREAM_PASSWORD=CHANGE_ME # Requested during Comet configuration; if incorrect, streams will not be proxied (Randomly generated if not set)
PROXY_DEBRID_STREAM_MAX_CONNECTIONS=-1 # -1 to disable connection limits
PROXY_DEBRID_STREAM_DEBRID_DEFAULT_SERVICE=realdebrid
PROXY_DEBRID_STREAM_DEBRID_DEFAULT_APIKEY=CHANGE_ME
PROXY_DEBRID_STREAM_INACTIVITY_THRESHOLD=300 # Seconds to wait before cleaning up an inactive connection. Set to 0 to disable.
# ============================== #
# Torrent Stream Policy #
# ============================== #
DISABLE_TORRENT_STREAMS=False # When true, torrent-only requests return a friendly message instead of magnets
TORRENT_DISABLED_STREAM_NAME=[INFO] Comet # Stremio stream name shown when torrents are disabled
TORRENT_DISABLED_STREAM_DESCRIPTION=Direct torrent playback is disabled on this server. # Description shown to users in Stremio
TORRENT_DISABLED_STREAM_URL=https://comet.feels.legal # Optional URL included in the placeholder stream response
# ============================== #
# Content Filtering #
# ============================== #
REMOVE_ADULT_CONTENT=False
RTN_FILTER_DEBUG=False # Set to True to log why torrents are excluded by RTN (debug only, verbose!)
FILTER_PARSE_CACHE_SIZE=10000 # Max RTN parse cache entries (0 disables)
FILTER_PARSE_CACHE_SHARDS=8 # Sharded LRU cache segments for parse cache
FILTER_PARSE_CACHE_DEDUP_INFLIGHT=True # De-duplicate concurrent parses per title
SMART_LANGUAGE_DETECTION=False # Set to True to enable language detection based on results title and Trakt aliases (experimental)
DIGITAL_RELEASE_FILTER=False # Filter unreleased content
TMDB_READ_ACCESS_TOKEN= # Optional: Provide your own TMDB Read Access Token to avoid using the shared default key
# ============================== #
# UI Customization #
# ============================== #
CUSTOM_HEADER_HTML=None
# ============================== #
# StremThru Integration #
# ============================== #
STREMTHRU_URL=https://stremthru.13377001.xyz # needed to use debrid services
DEBRID_ACCOUNT_SCRAPE_REFRESH_INTERVAL=900 # Seconds between periodic debrid account snapshot syncs
DEBRID_ACCOUNT_SCRAPE_CACHE_TTL=86400 # Snapshot retention in DB (seconds)
DEBRID_ACCOUNT_SCRAPE_MAX_SNAPSHOT_ITEMS=5000 # Max account magnets fetched during full sync
DEBRID_ACCOUNT_SCRAPE_MAX_MATCH_ITEMS=1500 # Max rows scanned per account for media matching
DEBRID_ACCOUNT_SCRAPE_INITIAL_WARM_TIMEOUT=5.0 # Max wait on first request to build missing snapshots (seconds)
# ============================== #
# HTTP Cache Settings #
# ============================== #
# These settings control HTTP-level caching.
# Comet sends proper Cache-Control headers that can be respected by proxies.
#
# Key cacheable endpoints:
# - /stream/{type}/{id}.json OR /s/<token>/stream/{type}/{id}.json (PUBLIC - shared cache, no user config)
# - /{config}/stream/... OR /s/<token>/{config}/stream/... (PRIVATE - user-specific, browser only)
# - /configure (PUBLIC when CONFIGURE_PAGE_PASSWORD disabled, PRIVATE otherwise)
HTTP_CACHE_ENABLED=False # Master switch for HTTP cache headers
# STREAMS streams TTL (for /stream/movie/tt1234567.json)
# These results are cached at edge and shared between all users.
# Higher = less traffic to origin, Lower = faster updates for new content
HTTP_CACHE_STREAMS_TTL=300 # 5 minutes
# Stale-While-Revalidate: serve stale content while fetching fresh in background
# Improves perceived performance - users get instant response with cached data
HTTP_CACHE_STALE_WHILE_REVALIDATE=60 # 1 minute
# MANIFEST TTL (for /manifest.json and /{config}/manifest.json, with or without /s/<token> prefix)
# Manifest rarely changes, can be cached longer
HTTP_CACHE_MANIFEST_TTL=86400 # 24 hours (recommended: 3600-86400)
# CONFIGURE page TTL (for /configure and /{config}/configure)
# Static page, can be cached for a long time (ignored when CONFIGURE_PAGE_PASSWORD is enabled)
HTTP_CACHE_CONFIGURE_TTL=86400 # 24 hours (recommended: 3600-86400)
# ============================== #
# HTTP Client Settings #
# ============================== #
# Shared HTTP client pool settings.
HTTP_CLIENT_LIMIT=100 # Total concurrent connections
HTTP_CLIENT_LIMIT_PER_HOST=20 # Per-host concurrent connections
HTTP_CLIENT_TTL_DNS_CACHE=300 # DNS cache TTL (seconds)
HTTP_CLIENT_KEEPALIVE_TIMEOUT=30 # Keep-alive timeout (seconds)
HTTP_CLIENT_TIMEOUT_TOTAL=30 # Total request timeout (seconds)
# ============================== #
# CometNet P2P Network #
# ============================== #
# CometNet is a decentralized P2P network that allows Comet instances to
# share torrent metadata automatically. When enabled, newly discovered
# torrents are propagated across the network, improving content coverage.
#
# ⚠️ EXPERIMENTAL: CometNet is a new feature and may have bugs.
#
# ====================================================================
# DEPLOYMENT CONFIGURATIONS:
# ====================================================================
# For detailed deployment instructions, please read the documentation:
# https://github.com/g0ldyy/comet
# ====================================================================
# === INTEGRATED MODE SETTINGS ===
COMETNET_ENABLED=False # Enable integrated CometNet P2P network (single instance only!)
COMETNET_LISTEN_PORT=8765 # WebSocket port for incoming P2P connections (ensure it's accessible if behind NAT)
COMETNET_HTTP_PORT=8766 # HTTP API port (only used by standalone service)
# === RELAY MODE SETTINGS (for clusters) ===
COMETNET_RELAY_URL= # URL of standalone CometNet service (e.g. http://cometnet:8766). When set, COMETNET_ENABLED is ignored.
COMETNET_API_KEY= # API key for standalone service authentication (Randomly generated if not set)
# === NETWORK DISCOVERY ===
# Bootstrap nodes are public entry points to join the network.
# Format: JSON array of WebSocket URLs
# Example: COMETNET_BOOTSTRAP_NODES='["wss://bootstrap1.cometnet.example:8765", "wss://bootstrap2.cometnet.example:8765"]'
COMETNET_BOOTSTRAP_NODES=[]
# Manual peers to connect to directly (trusted peers).
# Format: JSON array of WebSocket URLs
# Example: COMETNET_MANUAL_PEERS='["ws://trusted-peer.example.com:8765"]'
COMETNET_MANUAL_PEERS=[]
# === PEER MANAGEMENT ===
COMETNET_MAX_PEERS=50 # Maximum number of simultaneous peer connections
COMETNET_MIN_PEERS=3 # Minimum desired peers (will actively discover if below this)
# === IDENTITY & SECURITY ===
COMETNET_KEYS_DIR=data/cometnet # Directory to store P2P identity keys and state
COMETNET_ADVERTISE_URL= # Public URL to advertise to peers (e.g. wss://comet.example.com/cometnet/ws). Required if behind reverse proxy/domain.
COMETNET_NODE_ALIAS= # Optional friendly name for this node (exchanged with other peers)
COMETNET_KEY_PASSWORD= # Optional password to encrypt the private key on disk
# === ADVANCED SETTINGS ===
COMETNET_ALLOW_PRIVATE_PEX=False # Allow private/internal IPs via Peer Exchange (useful for LAN setups, disabled by default for security)
COMETNET_SKIP_REACHABILITY_CHECK=False # Skip the external reachability check on startup (useful for local testing only)
COMETNET_SKIP_TIME_CHECK=False # Skip the system clock synchronization check on startup
COMETNET_TIME_CHECK_TOLERANCE=60 # Maximum allowed clock drift in seconds compared to external reference (default: 60s)
COMETNET_TIME_CHECK_TIMEOUT=5 # Timeout in seconds for the time check request
COMETNET_STATE_SAVE_INTERVAL=300 # Periodic state save interval in seconds (5 minutes). Protects against data loss from abrupt container kills.
COMETNET_REACHABILITY_RETRIES=5 # Number of retry attempts for the reachability check (useful when using Traefik or other reverse proxies that take time to start)
COMETNET_REACHABILITY_RETRY_DELAY=10 # Delay in seconds between retry attempts for the reachability check
COMETNET_REACHABILITY_TIMEOUT=10 # Timeout in seconds for each reachability check attempt
COMETNET_UPNP_ENABLED=False # Enable UPnP to automatically open the listening port on your router (useful for home connections)
COMETNET_UPNP_LEASE_DURATION=3600 # UPnP port mapping lease duration in seconds (default: 1 hour)
# === GOSSIP TUNING (Advanced) ===
# Adjust how torrents propagate through the network.
COMETNET_GOSSIP_FANOUT=3 # Number of random peers to share a message with in each round
COMETNET_GOSSIP_INTERVAL=1.0 # Seconds between gossip rounds
COMETNET_GOSSIP_MESSAGE_TTL=5 # Max hops a message can travel before dying
COMETNET_GOSSIP_MAX_TORRENTS_PER_MESSAGE=1000 # Max torrents in a single gossip message
COMETNET_GOSSIP_VALIDATION_FUTURE_TOLERANCE=60 # Seconds to allow for clock drift in future timestamps
COMETNET_GOSSIP_VALIDATION_PAST_TOLERANCE=300 # Seconds to allow for clock drift in past timestamps
COMETNET_GOSSIP_TORRENT_MAX_AGE=604800 # Max age in seconds (7 days) for accepting torrent updates
# === DISCOVERY TUNING (Advanced) ===
# Adjust peer discovery and connection behavior.
COMETNET_PEX_BATCH_SIZE=20 # Number of peers to share in PEX responses
COMETNET_PEER_CONNECT_BACKOFF_MAX=300 # Max seconds to wait before reconnecting to a failed peer
COMETNET_PEER_MAX_FAILURES=5 # Max failures before temporarily banning a peer
COMETNET_PEER_CLEANUP_AGE=604800 # Seconds (7 days) to keep inactive peers in database
# === TRANSPORT TUNING (Advanced) ===
# Adjust network transport limitations.
COMETNET_TRANSPORT_MAX_MESSAGE_SIZE=10485760 # Max WebSocket message size in bytes (10MB)
COMETNET_TRANSPORT_MAX_CONNECTIONS_PER_IP=3 # Max connections allowed from a single IP (Anti-Sybil)
COMETNET_TRANSPORT_PING_INTERVAL=30.0 # Seconds between keepalive pings
COMETNET_TRANSPORT_CONNECTION_TIMEOUT=120.0 # Seconds before dropping a silent connection
COMETNET_TRANSPORT_MAX_LATENCY_MS=10000.0 # Max acceptable peer latency in ms (peers exceeding this are disconnected)
COMETNET_TRANSPORT_RATE_LIMIT_ENABLED=True # Enable rate limiting for incoming messages
COMETNET_TRANSPORT_RATE_LIMIT_COUNT=20 # Max messages per peer per window
COMETNET_TRANSPORT_RATE_LIMIT_WINDOW=1.0 # Window size in seconds
# === REPUTATION SYSTEM (Advanced) ===
# Adjust how peer trust is calculated. 0.0 to 10000.0.
COMETNET_REPUTATION_INITIAL=100.0
COMETNET_REPUTATION_MIN=0.0
COMETNET_REPUTATION_MAX=10000.0
COMETNET_REPUTATION_THRESHOLD_TRUSTED=1000.0 # Score needed to be considered "trusted" (approx 1 day of heavy scraping)
COMETNET_REPUTATION_THRESHOLD_UNTRUSTED=50.0 # Score below which a peer is ignored
COMETNET_REPUTATION_BONUS_VALID_CONTRIBUTION=0.001 # Bonus for every valid torrent contributed (1M torrents = 1000 pts)
COMETNET_REPUTATION_BONUS_PER_DAY_ANCIENNETY=10.0 # Daily bonus for long-running peers
COMETNET_REPUTATION_BONUS_MAX_ANCIENNETY=1000.0 # Max total bonus from anciennety
COMETNET_REPUTATION_PENALTY_INVALID_CONTRIBUTION=50.0 # Penalty for sending bad data
COMETNET_REPUTATION_PENALTY_SPAM_DETECTED=100.0 # Penalty for spamming
COMETNET_REPUTATION_PENALTY_INVALID_SIGNATURE=500.0 # Penalty for invalid cryptographic signatures
# ==============================================================================
# COMETNET - TRUST POOLS & PRIVATE NETWORKS
# ==============================================================================
# CometNet introduces Trust Pools for community organization and private networks
# for isolated deployments.
# === CONTRIBUTION MODE ===
# Controls what this node shares and receives on the network.
# - full: Share own torrents + receive + repropagate (default, full participation)
# - consumer: Receive + repropagate, but don't share own torrents (passive node)
# - source: Share own torrents only, don't receive (dedicated scraper)
# - leech: Receive only, don't repropagate (save bandwidth, selfish mode)
COMETNET_CONTRIBUTION_MODE=full
# === TRUST POOLS ===
# Trust Pools are groups of nodes that trust each other. When you subscribe to
# a pool, you only accept torrents from members of that pool.
#
# Format: JSON array of pool IDs to subscribe to
# Example: COMETNET_TRUSTED_POOLS='["official-sources", "french-community"]'
#
# If empty (default): Open mode - accept torrents from everyone
COMETNET_TRUSTED_POOLS=[]
# Directory for storing pool manifests, memberships, and invitations
COMETNET_POOLS_DIR=data/cometnet/pools
# === PRIVATE NETWORK ===
# Create or join a private, isolated CometNet network.
# Private networks are completely separate from the public network.
# Enable private network mode
COMETNET_PRIVATE_NETWORK=False
# Unique identifier for your private network (required if PRIVATE_NETWORK=True)
# Example: COMETNET_NETWORK_ID=my-private-network
COMETNET_NETWORK_ID=
# Password to join the private network (shared secret, required if PRIVATE_NETWORK=True)
# This password is never transmitted - it's used to derive authentication tokens
COMETNET_NETWORK_PASSWORD=
# Pools to ingest from even when in private mode (pull from public network)
# Format: JSON array of public pool IDs
# Example: COMETNET_INGEST_POOLS='["official-sources"]'
# This allows private networks to receive data from trusted public sources
COMETNET_INGEST_POOLS=[]