diff --git a/keyserver/src/socket/redis.js b/keyserver/src/socket/redis.js --- a/keyserver/src/socket/redis.js +++ b/keyserver/src/socket/redis.js @@ -21,11 +21,20 @@ } } +const redisConfig = (() => { + if (!process.env.REDIS_URL) { + return undefined; + } + return { + url: process.env.REDIS_URL, + }; +})(); + class RedisPublisher { pub: RedisClient; constructor() { - this.pub = redis.createClient(); + this.pub = redis.createClient(redisConfig); } sendMessage(target: UpdateTarget, message: RedisMessage) { @@ -52,7 +61,7 @@ onMessageCallback: OnMessage; constructor(sessionIdentifier: SessionIdentifier, onMessage: OnMessage) { - this.sub = redis.createClient(); + this.sub = redis.createClient(redisConfig); this.instanceID = uuidv4(); this.onMessageCallback = onMessage;