diff --git a/config/default.js b/config/default.js index 29ff00d..9a30fe4 100644 --- a/config/default.js +++ b/config/default.js @@ -20,7 +20,7 @@ export default { slackCron: process.env.SLACK_CRON || "*/10 * * * *", redis: { host: process.env.REDIS_HOST || "localhost", - remote_host: process.env.REDIS_REMOTE_HOST || "redis://redis:6379", + remote_host: process.env.REMOTE_REDIS_URL || "redis://redis:6379", }, logLevel: "info", rootDomain: process.env.ROOT_DOMAIN || "nos.social", diff --git a/docker-compose.yml b/docker-compose.yml index 32167f8..eb430fa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,7 @@ services: environment: - NODE_ENV=development - REDIS_HOST=redis + - REMOTE_REDIS_URL=redis://redis:6379 - ROOT_DOMAIN=localhost redis: diff --git a/src/getRedisClient.js b/src/getRedisClient.js index 32fa6aa..16b3f7e 100644 --- a/src/getRedisClient.js +++ b/src/getRedisClient.js @@ -6,7 +6,7 @@ const redisImportPromise = process.env.NODE_ENV === "test" ? import("ioredis-mock") : import("ioredis"); let redisClient; -let remoteRedisClient; +let vanishRequestsRedisClient; async function initializeNip05Redis() { try { @@ -28,12 +28,12 @@ async function initializeNip05Redis() { async function initializeVanishRequestsRedis() { try { const Redis = (await redisImportPromise).default; - remoteRedisClient = new Redis(config.redis.remote_host); + vanishRequestsRedisClient = new Redis(config.redis.remote_host); - remoteRedisClient.on("connect", () => + vanishRequestsRedisClient.on("connect", () => logger.info("Connected to vanish requests Redis") ); - remoteRedisClient.on("error", (err) => + vanishRequestsRedisClient.on("error", (err) => logger.error(err, "Vanish requests Redis error") ); } catch (error) { @@ -50,8 +50,8 @@ export async function getNip05RedisClient() { } export async function getVanishRequestsRedisClient() { - if (!remoteRedisClient) { + if (!vanishRequestsRedisClient) { await initializeVanishRequestsRedis(); } - return remoteRedisClient; + return vanishRequestsRedisClient; }