ioredis icon indicating copy to clipboard operation
ioredis copied to clipboard

Connection URL support for Cluster constructor

Open steprescott opened this issue 1 year ago • 2 comments

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

steprescott avatar Aug 10 '23 11:08 steprescott

@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.

steprescott avatar Aug 11 '23 17:08 steprescott

@luin just bumping this in hope it can be reviewed. If you need anything further from me please do let me know.

steprescott avatar Aug 30 '23 09:08 steprescott