Skip to content

Commit f76534b

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

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

packages/microservices/client/client-redis.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ export class ClientRedis extends ClientProxy {
3131
constructor(protected readonly options: RedisOptions['options']) {
3232
super();
3333
this.url =
34-
this.getOptionsProp(options, 'url') ??
35-
this.getOptionsProp(options, 'host')
36-
? undefined
37-
: REDIS_DEFAULT_URL;
34+
this.getOptionsProp(options, 'url') ||
35+
(!this.getOptionsProp(options, 'host') && REDIS_DEFAULT_URL);
3836

3937
redisPackage = loadPackage('redis', ClientRedis.name, () =>
4038
require('redis'),

packages/microservices/server/server-redis.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ export class ServerRedis extends Server implements CustomTransportStrategy {
3131
constructor(private readonly options: RedisOptions['options']) {
3232
super();
3333
this.url =
34-
this.getOptionsProp(options, 'url') ??
35-
this.getOptionsProp(options, 'host')
36-
? undefined
37-
: REDIS_DEFAULT_URL;
34+
this.getOptionsProp(options, 'url') ||
35+
(!this.getOptionsProp(options, 'host') && REDIS_DEFAULT_URL);
3836

3937
redisPackage = this.loadPackage('redis', ServerRedis.name, () =>
4038
require('redis'),

0 commit comments

Comments
 (0)