-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add auth option for redis #8
Conversation
redis/redis.go
Outdated
if store.auth != "" { | ||
_ = c.Send("AUTH", store.auth) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is the right place for this.
AUTH needs to be the first command that we send - but is that per connection, or per connection pool? If it's per connection then we would need to do it every time we called store.getConn
, i.e. for every kind of operation. But then we'd have no way of knowing if this is a new connection or a reused one.
I think possibly the way we're supposed to do this is by specifying the DialPassword option when we call redis.DialURL()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eli-darkly You're right, this should've been per Connection.
I updated the commit to use the redis.DialPassword
option in redis.DialURL()
.
I had two more thoughts about this, a bit late:
That would mean we are surfacing Redigo API details in our own API, but that is already the approach we use in our other SDKs where we provide direct access to advanced configuration options of the underlying implementation of Redis or DynamoDB or the HTTP client or whatever—and if we ever release a Redis integration that does not use Redigo, it will be in a new major version (and possibly will be broken out into a separate project, rather than being a subpackage of the SDK). So I think I would rather add that general feature now, rather than trying to anticipate all the other options people might want to use. |
By the way, I've retargeted this PR to the |
And since we're doing that, I'm fine with merging this now, and then we can consider making the additional changes I suggested. |
Some instances of Redis (Microsoft Azure Redis Cache for example) require authentication before allowing any other commands to be executed.