redbird icon indicating copy to clipboard operation
redbird copied to clipboard

Allow setting URL for redis config

Open germsvel opened this issue 4 years ago • 2 comments

What changed?

We allow setting a Redis URL in our config via redis_options instead of having to specify a host, port, and password.

E.g.

// instead of this
config :redbird, :redis_options, [host: ...]

// we can now do this
config :redbird, :redis_options, [url: "redis:// ..."]

This is particularly helpful when dealing with Redis + SSL, when the URL scheme changes from redis to rediss.

Implementation details

Redix (the library we use to communicate with Redis) will automatically set ssl: true when it is passed a URL with a rediss scheme.

Unfortunately, the only way to pass a URL to Redix is by passing a modified set of options ({url, list_of_opts} instead of list_of_opts).

Instead of passing those options to Redbird.Redis.start_link/1 only to then pass them again to Redix.start_link/1, we now rely on Redix's child_spec function directly, and put it in our supervision tree.

Finally, to abstract the configuration of options, we create a new module Redbird.Config which handles the merging of options and separating the url from the rest of the options if one is present.

germsvel avatar Dec 21 '20 16:12 germsvel

I'd love to use this project and this is the only blocker for me at the moment.

JacquiManzi avatar May 24 '21 14:05 JacquiManzi

Seems like this PR got approved quite while ago but still not merged into master? As @JacquiManzi mentioned this is the only blocker for us to upgrade redbird to the latest version and we hope to see this to be merged soon.

relip avatar Feb 09 '22 11:02 relip