ioredis
ioredis copied to clipboard
Connection URL support for Cluster constructor
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:
- If a url of
rediss://node-1,node-2
was given would you assume all connections are using tls? - If a url contained options
redis://node-1,node-2/1?key=value
should it copy all options over to all nodes? - Should we add
| 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 https://github.com/redis/ioredis/issues/1519
@luin Sorry if this is not the right approach but do I need to tag you or someone else to start the review process? I wasn't sure after reading the contribution section of the README.md
.
@luin just bumping this in hope it can be reviewed. If you need anything further from me please do let me know.