pnxtech / hydra

A light-weight library for building distributed applications such as microservices
https://www.hydramicroservice.com
MIT License
645 stars 54 forks source link

Allow more options for redis connection #37

Closed emadum closed 7 years ago

emadum commented 7 years ago

redis.createClient supports a number of invocation formats:

  1. redis.createClient([options])
  2. redis.createClient(unix_socket[, options])
  3. redis.createClient(redis_url[, options])
  4. redis.createClient(port[, host][, options])

We're currently using 4, but we're not passing through options we don't use. I think it'd be better to use 1, and pass through options from the hydra.redis config entry.

One thing to point out is that we use url instead of host for the host option. url is also a valid redis createClient option (also used by createClient invocation option 3), with format: [redis:]//[[user][:password@]][host][:port][/db-number][?db=db-number[&password=bar[&option=value]]] This could be confusing and we should probably try to be more consistent with the redis options.

At the very least, we should support passing in a password for Redis servers with auth enabled.

emadum commented 7 years ago

docs for redis.createClient