mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
Fix redis connection strings for consistency across languages. (#168)
* Fix redis connection strings across languages * compose version bump
This commit is contained in:
@@ -25,7 +25,9 @@ export const cinemetaConfig = {
|
||||
}
|
||||
|
||||
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),
|
||||
IMDB_TTL: parseInt(process.env.IMDB_TTL || 60 * 60 * 4), // 4 Hours
|
||||
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
|
||||
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 = {
|
||||
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),
|
||||
}
|
||||
|
||||
cacheConfig.REDIS_CONNECTION_STRING = 'redis://' + cacheConfig.REDIS_HOST + ':' + cacheConfig.REDIS_PORT + cacheConfig.REDIS_EXTRA;
|
||||
|
||||
export const databaseConfig = {
|
||||
POSTGRES_HOST: process.env.POSTGRES_HOST || 'postgres',
|
||||
POSTGRES_PORT: process.env.POSTGRES_PORT || '5432',
|
||||
|
||||
@@ -3,7 +3,12 @@ namespace SharedContracts.Configuration;
|
||||
public class RedisConfiguration
|
||||
{
|
||||
private const string Prefix = "REDIS";
|
||||
private const string ConnectionStringVariable = "CONNECTION_STRING";
|
||||
|
||||
public string? ConnectionString { get; init; } = Prefix.GetRequiredEnvironmentVariableAsString(ConnectionStringVariable) + ",abortConnect=false,allowAdmin=true";
|
||||
private const string HostVariable = "HOST";
|
||||
private const string PortVariable = "PORT";
|
||||
private const string ExtraVariable = "EXTRA";
|
||||
|
||||
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