Fix redis connection strings for consistency across languages. (#168)
* Fix redis connection strings across languages * compose version bump
This commit is contained in:
@@ -9,7 +9,9 @@ POSTGRES_PASSWORD=postgres
|
|||||||
POSTGRES_DB=knightcrawler
|
POSTGRES_DB=knightcrawler
|
||||||
|
|
||||||
# Redis
|
# Redis
|
||||||
REDIS_CONNECTION_STRING=redis:6379
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_EXTRA=abortConnect=false,allowAdmin=true
|
||||||
|
|
||||||
# RabbitMQ
|
# RabbitMQ
|
||||||
RABBITMQ_HOST=rabbitmq
|
RABBITMQ_HOST=rabbitmq
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ x-depends: &knightcrawler-app-depends
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
metadata:
|
metadata:
|
||||||
image: gabisonfire/knightcrawler-metadata:2.0.1
|
image: gabisonfire/knightcrawler-metadata:2.0.2
|
||||||
env_file: ../.env
|
env_file: ../.env
|
||||||
networks:
|
networks:
|
||||||
- knightcrawler-network
|
- knightcrawler-network
|
||||||
@@ -30,7 +30,7 @@ services:
|
|||||||
condition: service_completed_successfully
|
condition: service_completed_successfully
|
||||||
|
|
||||||
migrator:
|
migrator:
|
||||||
image: gabisonfire/knightcrawler-migrator:2.0.1
|
image: gabisonfire/knightcrawler-migrator:2.0.2
|
||||||
env_file: ../.env
|
env_file: ../.env
|
||||||
networks:
|
networks:
|
||||||
- knightcrawler-network
|
- knightcrawler-network
|
||||||
@@ -40,7 +40,7 @@ services:
|
|||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|
||||||
addon:
|
addon:
|
||||||
image: gabisonfire/knightcrawler-addon:2.0.1
|
image: gabisonfire/knightcrawler-addon:2.0.2
|
||||||
<<: [*knightcrawler-app, *knightcrawler-app-depends]
|
<<: [*knightcrawler-app, *knightcrawler-app-depends]
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
hostname: knightcrawler-addon
|
hostname: knightcrawler-addon
|
||||||
@@ -48,22 +48,22 @@ services:
|
|||||||
- "7000:7000"
|
- "7000:7000"
|
||||||
|
|
||||||
consumer:
|
consumer:
|
||||||
image: gabisonfire/knightcrawler-consumer:2.0.1
|
image: gabisonfire/knightcrawler-consumer:2.0.2
|
||||||
<<: [*knightcrawler-app, *knightcrawler-app-depends]
|
<<: [*knightcrawler-app, *knightcrawler-app-depends]
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
debridcollector:
|
debridcollector:
|
||||||
image: gabisonfire/knightcrawler-debrid-collector:2.0.1
|
image: gabisonfire/knightcrawler-debrid-collector:2.0.2
|
||||||
<<: [*knightcrawler-app, *knightcrawler-app-depends]
|
<<: [*knightcrawler-app, *knightcrawler-app-depends]
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
producer:
|
producer:
|
||||||
image: gabisonfire/knightcrawler-producer:2.0.1
|
image: gabisonfire/knightcrawler-producer:2.0.2
|
||||||
<<: [*knightcrawler-app, *knightcrawler-app-depends]
|
<<: [*knightcrawler-app, *knightcrawler-app-depends]
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
qbitcollector:
|
qbitcollector:
|
||||||
image: gabisonfire/knightcrawler-qbit-collector:2.0.1
|
image: gabisonfire/knightcrawler-qbit-collector:2.0.2
|
||||||
<<: [*knightcrawler-app, *knightcrawler-app-depends]
|
<<: [*knightcrawler-app, *knightcrawler-app-depends]
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ export const cinemetaConfig = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const cacheConfig = {
|
export const cacheConfig = {
|
||||||
REDIS_CONNECTION_STRING: process.env.REDIS_CONNECTION_STRING || 'redis://localhost:6379/0',
|
REDIS_HOST: process.env.REDIS_HOST || 'redis',
|
||||||
|
REDIS_PORT: process.env.REDIS_PORT || '6379',
|
||||||
|
REDIS_EXTRA: process.env.REDIS_EXTRA || '',
|
||||||
NO_CACHE: parseBool(process.env.NO_CACHE, false),
|
NO_CACHE: parseBool(process.env.NO_CACHE, false),
|
||||||
IMDB_TTL: parseInt(process.env.IMDB_TTL || 60 * 60 * 4), // 4 Hours
|
IMDB_TTL: parseInt(process.env.IMDB_TTL || 60 * 60 * 4), // 4 Hours
|
||||||
STREAM_TTL: parseInt(process.env.STREAM_TTL || 60 * 60 * 4), // 1 Hour
|
STREAM_TTL: parseInt(process.env.STREAM_TTL || 60 * 60 * 4), // 1 Hour
|
||||||
@@ -40,3 +42,5 @@ export const cacheConfig = {
|
|||||||
STALE_ERROR_AGE: parseInt(process.env.STALE_ERROR_AGE) || 7 * 24 * 60 * 60, // 7 days
|
STALE_ERROR_AGE: parseInt(process.env.STALE_ERROR_AGE) || 7 * 24 * 60 * 60, // 7 days
|
||||||
GLOBAL_KEY_PREFIX: process.env.GLOBAL_KEY_PREFIX || 'jackettio-addon',
|
GLOBAL_KEY_PREFIX: process.env.GLOBAL_KEY_PREFIX || 'jackettio-addon',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cacheConfig.REDIS_CONNECTION_STRING = 'redis://' + cacheConfig.REDIS_HOST + ':' + cacheConfig.REDIS_PORT + cacheConfig.REDIS_EXTRA;
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
export const cacheConfig = {
|
export const cacheConfig = {
|
||||||
REDIS_CONNECTION_STRING: process.env.REDIS_CONNECTION_STRING || 'redis://localhost:6379/0',
|
REDIS_HOST: process.env.REDIS_HOST || 'redis',
|
||||||
|
REDIS_PORT: process.env.REDIS_PORT || '6379',
|
||||||
|
REDIS_EXTRA: process.env.REDIS_EXTRA || '',
|
||||||
NO_CACHE: parseBool(process.env.NO_CACHE, false),
|
NO_CACHE: parseBool(process.env.NO_CACHE, false),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cacheConfig.REDIS_CONNECTION_STRING = 'redis://' + cacheConfig.REDIS_HOST + ':' + cacheConfig.REDIS_PORT + cacheConfig.REDIS_EXTRA;
|
||||||
|
|
||||||
export const databaseConfig = {
|
export const databaseConfig = {
|
||||||
POSTGRES_HOST: process.env.POSTGRES_HOST || 'postgres',
|
POSTGRES_HOST: process.env.POSTGRES_HOST || 'postgres',
|
||||||
POSTGRES_PORT: process.env.POSTGRES_PORT || '5432',
|
POSTGRES_PORT: process.env.POSTGRES_PORT || '5432',
|
||||||
|
|||||||
@@ -3,7 +3,12 @@ namespace SharedContracts.Configuration;
|
|||||||
public class RedisConfiguration
|
public class RedisConfiguration
|
||||||
{
|
{
|
||||||
private const string Prefix = "REDIS";
|
private const string Prefix = "REDIS";
|
||||||
private const string ConnectionStringVariable = "CONNECTION_STRING";
|
private const string HostVariable = "HOST";
|
||||||
|
private const string PortVariable = "PORT";
|
||||||
|
private const string ExtraVariable = "EXTRA";
|
||||||
|
|
||||||
public string? ConnectionString { get; init; } = Prefix.GetRequiredEnvironmentVariableAsString(ConnectionStringVariable) + ",abortConnect=false,allowAdmin=true";
|
private string Host { get; init; } = Prefix.GetRequiredEnvironmentVariableAsString(HostVariable);
|
||||||
|
private int PORT { get; init; } = Prefix.GetEnvironmentVariableAsInt(PortVariable, 6379);
|
||||||
|
private string EXTRA { get; init; } = Prefix.GetOptionalEnvironmentVariableAsString(ExtraVariable, "?abortConnect=false,allowAdmin=true");
|
||||||
|
public string ConnectionString => $"{Host}:{PORT}{EXTRA}";
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user