Skip to content

Commit

Permalink
fix(api+indexer): add configurable redis sentinel password
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewklau committed Apr 23, 2024
1 parent 533b7f8 commit 1fb1e7e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
7 changes: 5 additions & 2 deletions apps/api/src/libs/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ if (config.redisSentinelName) {
if (urls.length) {
options = {
name: config.redisSentinelName,
password: config.redisPassword,
sentinelPassword: config.redisSentinelPassword,
sentinels: urls.map((u) => {
const url = new URL(u);

return { host: url.hostname, port: +url.port };
}),
};

if (config.redisPassword) {
options.password = config.redisPassword;
options.sentinelPassword = config.redisPassword;
}
}
}

Expand Down
5 changes: 1 addition & 4 deletions apps/backend/src/libs/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,13 @@ if (config.redisSentinelName) {
sentinels: urls.map((u) => {
const url = new URL(u);

if (url.password) {
return { host: url.hostname, password: url.password, port: +url.port };
}

return { host: url.hostname, port: +url.port };
}),
};

if (config.redisPassword) {
options.password = config.redisPassword;
options.sentinelPassword = config.redisPassword;
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion apps/indexer-base/src/libs/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@ if (config.redisSentinelName) {
if (urls.length) {
options = {
name: config.redisSentinelName,
password: config.redisPassword,
sentinels: urls.map((u) => {
const url = new URL(u);

return { host: url.hostname, port: +url.port };
}),
};

if (config.redisPassword) {
options.password = config.redisPassword;
options.sentinelPassword = config.redisPassword;
}
}
}

Expand Down

0 comments on commit 1fb1e7e

Please sign in to comment.