Connection URL support for Cluster constructor #1794
+15
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently to pass multiple startup nodes it can only be done by passing them as separate items in the array.
This PR adds support to allow for multiple hosts to be configured if they appear in a URL string.
Discussion points
I've tried to be light touch and assume as little as possible but a few points to think over:
rediss://node-1,node-2
was given would you assume all connections are using tls?redis://node-1,node-2/1?key=value
should it copy all options over to all nodes?| string
to Cluster constructer to allow it to be created using a URL string.Redis.Cluster("redis://node-1")
At the moment it does none of these and just takes what is supplied and continues to keep all assumptions made by ioredis as I've only added a parsing check for commas and then separate them into their own
startupNode
.Happy to discuss your thoughts on the approach.
Resolves #1519