-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Automatically set tls.servername option with rediss:// URLs #950
Conversation
9ddb978
to
90040f9
Compare
90040f9
to
d6fc213
Compare
@luin Would you mind taking a look at this? It would be great to get this merged as Shields is currently blocked from upgrading. Thanks a lot! |
} else if (typeof arg === "number") { | ||
this.options.port = arg; | ||
} else { | ||
throw new Error("Invalid argument " + arg); | ||
} | ||
} | ||
if (isTls) { | ||
defaults(this.options, { tls: { servername: this.options.host } }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if setting tls
to this.options.host
instead of true
applies to more scenarios, but I think at least we need to check whether this.options.host
is a hostname instead of an IP address.
As for me, I prefer the way that we just default tls
options to true
without setting any other properties (like servername
) and let users handle it. The improvement we should make here is to keep the options provided by users not be overwritten.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if setting
tls
tothis.options.host
instead oftrue
applies to more scenarios, but I think at least we need to check whetherthis.options.host
is a hostname instead of an IP address.
I'm happy to make that modification if you'd like.
Setting tls.options.host
to the hostname of the server is necessary to use many shared Redis hosting services, including Compose.io and Redis Labs. It reduces boilerplate and seems like a reasonable default as this is not really a fringe use case, but a common scenario for TLS.
The improvement we should make here is to keep the options provided by users not be overwritten.
Alternatively, #949 does just that!
## [4.14.1](redis/ioredis@v4.14.0...v4.14.1) (2019-08-27) ### Bug Fixes * don’t clobber passed-in tls options with rediss:/ URLs ([#949](redis/ioredis#949)) ([ceefcfa](redis/ioredis@ceefcfa)), closes [#942](redis/ioredis#942) [#940](redis/ioredis#940) [#950](redis/ioredis#950) [#948](redis/ioredis#948)
Fix #948
Fix #940
Alternative to #949 and #942