Support using redis urls to construct the redis client #1994
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently Athens only supports connecting to Redis using a
hostname:port
combination in addition to a password. While this works in most cases it also means that if you have other options you wish to supply Athens has to be updated to support them. As a basic example Redis clusters that require TLS currently are not supported by Athens but with this change you can simply supply a redis url to connect over TLS. It also makes it easy to override the password, set a username and more all from a single configuration option:rediss://username:[email protected]:6379/1?protocol=3
What is the problem I am trying to address?
The redis cluster I'm using has a specific username, password and requires TLS to connect to it. Athens doesn't appear to support these options today (other than password).
How is the fix applied?
Updated the code constructing the redis client to support using a url, example here: https://github.com/redis/go-redis?tab=readme-ov-file#connecting-via-a-redis-url.
This change also ensures that if you are also setting a password but start using the new url form, and the two don't agree, an error will be returned. Didn't want someone to end up in a situation where they defined a password in the configuration but not in the redis url and expected the two to be combined.