3 Commits

Author SHA1 Message Date
iPromKnight
9f928f9b66 Allow trackers url to be configurable + version bump (#173)
this allows people to use only the udp collection, only the tcp collection, or all.
2024-03-26 12:17:47 +00:00
iPromKnight
a50b5071b3 key prefixes per collector (#172)
* Ensure the collectors manage sagas in their own keyspace, as we do not want overlap (they have the same correlation ids internally from the exchange)

* version bump
2024-03-26 11:56:14 +00:00
iPromKnight
72db18f0ad add missing env (#171)
* add missing env

* version bump
2024-03-26 11:16:21 +00:00
6 changed files with 23 additions and 14 deletions

View File

@@ -30,6 +30,8 @@ METADATA_INSERT_BATCH_SIZE=50000
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

View File

@@ -20,7 +20,7 @@ x-depends: &knightcrawler-app-depends
services:
metadata:
image: gabisonfire/knightcrawler-metadata:2.0.4
image: gabisonfire/knightcrawler-metadata:2.0.7
env_file: ../.env
networks:
- knightcrawler-network
@@ -30,7 +30,7 @@ services:
condition: service_completed_successfully
migrator:
image: gabisonfire/knightcrawler-migrator:2.0.4
image: gabisonfire/knightcrawler-migrator:2.0.7
env_file: ../.env
networks:
- knightcrawler-network
@@ -40,7 +40,7 @@ services:
condition: service_healthy
addon:
image: gabisonfire/knightcrawler-addon:2.0.4
image: gabisonfire/knightcrawler-addon:2.0.7
<<: [*knightcrawler-app, *knightcrawler-app-depends]
restart: unless-stopped
hostname: knightcrawler-addon
@@ -48,22 +48,22 @@ services:
- "7000:7000"
consumer:
image: gabisonfire/knightcrawler-consumer:2.0.4
image: gabisonfire/knightcrawler-consumer:2.0.7
<<: [*knightcrawler-app, *knightcrawler-app-depends]
restart: unless-stopped
debridcollector:
image: gabisonfire/knightcrawler-debrid-collector:2.0.4
image: gabisonfire/knightcrawler-debrid-collector:2.0.7
<<: [*knightcrawler-app, *knightcrawler-app-depends]
restart: unless-stopped
producer:
image: gabisonfire/knightcrawler-producer:2.0.4
image: gabisonfire/knightcrawler-producer:2.0.7
<<: [*knightcrawler-app, *knightcrawler-app-depends]
restart: unless-stopped
qbitcollector:
image: gabisonfire/knightcrawler-qbit-collector:2.0.4
image: gabisonfire/knightcrawler-qbit-collector:2.0.7
<<: [*knightcrawler-app, *knightcrawler-app-depends]
restart: unless-stopped
depends_on:

View File

@@ -62,7 +62,10 @@ public static class ServiceCollectionExtensions
cfg.UseMessageRetry(r => r.Intervals(1000,2000,5000));
cfg.UseInMemoryOutbox();
})
.RedisRepository(redisConfiguration.ConnectionString)
.RedisRepository(redisConfiguration.ConnectionString, options =>
{
options.KeyPrefix = "debrid-collector:";
})
.Endpoint(
e =>
{

View File

@@ -99,7 +99,10 @@ public static class ServiceCollectionExtensions
timeout.Timeout = TimeSpan.FromMinutes(1);
});
})
.RedisRepository(redisConfiguration.ConnectionString);
.RedisRepository(redisConfiguration.ConnectionString, options =>
{
options.KeyPrefix = "qbit-collector:";
});
private static void AddQBitTorrentClient(this IServiceCollection services)
{

View File

@@ -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);
}

View File

@@ -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()
@@ -42,7 +41,7 @@ public class TrackersService(IDistributedCache cache, HttpClient client, IMemory
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);