Skip to content

Commit

Permalink
Allow trackers url to be configurable + version bump (#173)
Browse files Browse the repository at this point in the history
this allows people to use only the udp collection, only the tcp collection, or all.
  • Loading branch information
iPromKnight authored Mar 26, 2024
1 parent a50b507 commit 9f928f9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
1 change: 1 addition & 0 deletions deployment/docker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ COLLECTOR_QBIT_ENABLED=false
COLLECTOR_DEBRID_ENABLED=true
COLLECTOR_REAL_DEBRID_API_KEY=
QBIT_HOST=http://qbittorrent:8080
QBIT_TRACKERS_URL=https://ngosang.github.io/trackerslist/trackers_all.txt

# Addon
DEBUG_MODE=false
Expand Down
14 changes: 7 additions & 7 deletions deployment/docker/components/knightcrawler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ x-depends: &knightcrawler-app-depends

services:
metadata:
image: gabisonfire/knightcrawler-metadata:2.0.6
image: gabisonfire/knightcrawler-metadata:2.0.7
env_file: ../.env
networks:
- knightcrawler-network
Expand All @@ -30,7 +30,7 @@ services:
condition: service_completed_successfully

migrator:
image: gabisonfire/knightcrawler-migrator:2.0.6
image: gabisonfire/knightcrawler-migrator:2.0.7
env_file: ../.env
networks:
- knightcrawler-network
Expand All @@ -40,30 +40,30 @@ services:
condition: service_healthy

addon:
image: gabisonfire/knightcrawler-addon:2.0.6
image: gabisonfire/knightcrawler-addon:2.0.7
<<: [*knightcrawler-app, *knightcrawler-app-depends]
restart: unless-stopped
hostname: knightcrawler-addon
ports:
- "7000:7000"

consumer:
image: gabisonfire/knightcrawler-consumer:2.0.6
image: gabisonfire/knightcrawler-consumer:2.0.7
<<: [*knightcrawler-app, *knightcrawler-app-depends]
restart: unless-stopped

debridcollector:
image: gabisonfire/knightcrawler-debrid-collector:2.0.6
image: gabisonfire/knightcrawler-debrid-collector:2.0.7
<<: [*knightcrawler-app, *knightcrawler-app-depends]
restart: unless-stopped

producer:
image: gabisonfire/knightcrawler-producer:2.0.6
image: gabisonfire/knightcrawler-producer:2.0.7
<<: [*knightcrawler-app, *knightcrawler-app-depends]
restart: unless-stopped

qbitcollector:
image: gabisonfire/knightcrawler-qbit-collector:2.0.6
image: gabisonfire/knightcrawler-qbit-collector:2.0.7
<<: [*knightcrawler-app, *knightcrawler-app-depends]
restart: unless-stopped
depends_on:
Expand Down
6 changes: 4 additions & 2 deletions src/qbit-collector/Features/Qbit/QbitConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ namespace QBitCollector.Features.Qbit;
public class QbitConfiguration
{
private const string Prefix = "QBIT";
private const string ConnectionStringVariable = "HOST";
private const string HOST_VARIABLE = "HOST";
private const string TRACKERS_URL_VARIABLE = "TRACKERS_URL";

public string? Host { get; init; } = Prefix.GetRequiredEnvironmentVariableAsString(ConnectionStringVariable);
public string? Host { get; init; } = Prefix.GetRequiredEnvironmentVariableAsString(HOST_VARIABLE);
public string? TrackersUrl { get; init; } = Prefix.GetRequiredEnvironmentVariableAsString(TRACKERS_URL_VARIABLE);
}
5 changes: 2 additions & 3 deletions src/qbit-collector/Features/Trackers/TrackersService.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
namespace QBitCollector.Features.Trackers;

public class TrackersService(IDistributedCache cache, HttpClient client, IMemoryCache memoryCache) : ITrackersService
public class TrackersService(IDistributedCache cache, HttpClient client, IMemoryCache memoryCache, QbitConfiguration configuration) : ITrackersService
{
private const string TrackersListUrl = "https://ngosang.github.io/trackerslist/trackers_all.txt";
private const string CacheKey = "trackers";

public async Task<List<string>> GetTrackers()
Expand Down Expand Up @@ -42,7 +41,7 @@ public async Task<List<string>> GetTrackers()

private async Task<List<string>> GetTrackersAsync()
{
var response = await client.GetStringAsync(TrackersListUrl);
var response = await client.GetStringAsync(configuration.TrackersUrl);

var lines = response.Split(["\r\n", "\r", "\n"], StringSplitOptions.None);

Expand Down

0 comments on commit 9f928f9

Please sign in to comment.