Skip to content

Commit

Permalink
Align env var name with ansible
Browse files Browse the repository at this point in the history
  • Loading branch information
dcadenas committed Oct 15, 2024
1 parent 8cbcf1f commit c8756f4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
environment:
- NODE_ENV=development
- REDIS_HOST=redis
- REMOTE_REDIS_URL=redis://redis:6379
- ROOT_DOMAIN=localhost

redis:
Expand Down
12 changes: 6 additions & 6 deletions src/getRedisClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand All @@ -50,8 +50,8 @@ export async function getNip05RedisClient() {
}

export async function getVanishRequestsRedisClient() {
if (!remoteRedisClient) {
if (!vanishRequestsRedisClient) {
await initializeVanishRequestsRedis();
}
return remoteRedisClient;
return vanishRequestsRedisClient;
}

0 comments on commit c8756f4

Please sign in to comment.