redbird
redbird copied to clipboard
Allow setting URL for redis config
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.
I'd love to use this project and this is the only blocker for me at the moment.
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.