diff --git a/apps/server/src/collaboration/collaboration.gateway.ts b/apps/server/src/collaboration/collaboration.gateway.ts index 05536664e..254b8d430 100644 --- a/apps/server/src/collaboration/collaboration.gateway.ts +++ b/apps/server/src/collaboration/collaboration.gateway.ts @@ -63,6 +63,7 @@ export class CollaborationGateway { redis: new RedisClient({ host: this.redisConfig.host, port: this.redisConfig.port, + username: this.redisConfig.username, password: this.redisConfig.password, db: this.redisConfig.db, family: this.redisConfig.family, diff --git a/apps/server/src/common/helpers/utils.ts b/apps/server/src/common/helpers/utils.ts index 100d55d92..aebe05385 100644 --- a/apps/server/src/common/helpers/utils.ts +++ b/apps/server/src/common/helpers/utils.ts @@ -28,6 +28,7 @@ export type RedisConfig = { host: string; port: number; db: number; + username?: string; password?: string; family?: number; tls?: { rejectUnauthorized?: boolean }; @@ -36,7 +37,15 @@ export type RedisConfig = { export function parseRedisUrl(redisUrl: string): RedisConfig { // format - redis[s]://[[username][:password]@][host][:port][/db-number][?family=4|6][&rejectUnauthorized=false] const url = new URL(redisUrl); - const { hostname, port, password, pathname, protocol, searchParams } = url; + const { + hostname, + port, + username, + password, + pathname, + protocol, + searchParams, + } = url; const portInt = port ? parseInt(port, 10) : 6379; let db: number = 0; @@ -62,7 +71,15 @@ export function parseRedisUrl(redisUrl: string): RedisConfig { : {} : undefined; - return { host: hostname, port: portInt, password: password || undefined, db, family, tls }; + return { + host: hostname, + port: portInt, + username: username ? decodeURIComponent(username) : undefined, + password: password ? decodeURIComponent(password) : undefined, + db, + family, + tls, + }; } export function createRetryStrategy() { diff --git a/apps/server/src/integrations/queue/queue.module.ts b/apps/server/src/integrations/queue/queue.module.ts index fcb317dbf..0c2c3c908 100644 --- a/apps/server/src/integrations/queue/queue.module.ts +++ b/apps/server/src/integrations/queue/queue.module.ts @@ -15,6 +15,7 @@ import { GeneralQueueProcessor } from './processors/general-queue.processor'; connection: { host: redisConfig.host, port: redisConfig.port, + username: redisConfig.username, password: redisConfig.password, db: redisConfig.db, family: redisConfig.family, diff --git a/apps/server/src/integrations/redis/redis-config.service.ts b/apps/server/src/integrations/redis/redis-config.service.ts index 7f3e90174..c613e0389 100644 --- a/apps/server/src/integrations/redis/redis-config.service.ts +++ b/apps/server/src/integrations/redis/redis-config.service.ts @@ -16,6 +16,7 @@ export class RedisConfigService implements RedisOptionsFactory { config: { host: redisConfig.host, port: redisConfig.port, + username: redisConfig.username, password: redisConfig.password, db: redisConfig.db, family: redisConfig.family, diff --git a/apps/server/src/integrations/throttle/throttle.module.ts b/apps/server/src/integrations/throttle/throttle.module.ts index e22eddc75..4c9537526 100644 --- a/apps/server/src/integrations/throttle/throttle.module.ts +++ b/apps/server/src/integrations/throttle/throttle.module.ts @@ -33,6 +33,7 @@ import Redis from 'ioredis'; new Redis({ host: redisConfig.host, port: redisConfig.port, + username: redisConfig.username, password: redisConfig.password, db: redisConfig.db, family: redisConfig.family,