Skip to content

Commit 2208a87

Browse files
fix(microservices): when host present, ignore default url (redis)
1 parent e329f25 commit 2208a87

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/microservices/client/client-redis.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ export class ClientRedis extends ClientProxy {
3030

3131
constructor(protected readonly options: RedisOptions['options']) {
3232
super();
33-
this.url = this.getOptionsProp(options, 'url') || REDIS_DEFAULT_URL;
33+
this.url =
34+
this.getOptionsProp(options, 'url') ??
35+
this.getOptionsProp(options, 'host')
36+
? undefined
37+
: REDIS_DEFAULT_URL;
3438

3539
redisPackage = loadPackage('redis', ClientRedis.name, () =>
3640
require('redis'),

packages/microservices/server/server-redis.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ export class ServerRedis extends Server implements CustomTransportStrategy {
3030

3131
constructor(private readonly options: RedisOptions['options']) {
3232
super();
33-
this.url = this.getOptionsProp(this.options, 'url') || REDIS_DEFAULT_URL;
33+
this.url =
34+
this.getOptionsProp(options, 'url') ??
35+
this.getOptionsProp(options, 'host')
36+
? undefined
37+
: REDIS_DEFAULT_URL;
3438

3539
redisPackage = this.loadPackage('redis', ServerRedis.name, () =>
3640
require('redis'),

0 commit comments

Comments
 (0)