redis / go-redis

Redis Go client
https://redis.uptrace.dev
BSD 2-Clause "Simplified" License
19.61k stars 2.31k forks source link

Add CredentialsProvider field to UniversalOptions #2927

Open dcherubini opened 4 months ago

dcherubini commented 4 months ago

In https://github.com/redis/go-redis/pull/2097 go-redis started to support passing a CredentialsProvider callback to get the username and password when initializing a connection, instead of having to provide them when creating the client. This is very useful in scenarios where you have these credentials stored in a separate service (e.g., AWS Secret Manager or Azure Key Vault) and you want to rotate those credentials periodically.

However, this option was not added in all clients and was not being passed down from the universal client to the concrete clients either. This PR aims to normalize that.

(Note that the CredentialsProviders field was already added to ClusterOptions in https://github.com/redis/go-redis/pull/2791, which is why they are not being touched in this change)