mirror of
https://github.com/redis/go-redis.git
synced 2025-04-17 20:17:02 +03:00
add streamingcredentialsprovider in options
This commit is contained in:
parent
df9bfce954
commit
140a278bb8
@ -13,6 +13,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/redis/go-redis/v9/auth"
|
||||||
"github.com/redis/go-redis/v9/internal/pool"
|
"github.com/redis/go-redis/v9/internal/pool"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -74,6 +75,14 @@ type Options struct {
|
|||||||
// There will be a conflict between them; if CredentialsProviderContext exists, we will ignore CredentialsProvider.
|
// There will be a conflict between them; if CredentialsProviderContext exists, we will ignore CredentialsProvider.
|
||||||
CredentialsProviderContext func(ctx context.Context) (username string, password string, err error)
|
CredentialsProviderContext func(ctx context.Context) (username string, password string, err error)
|
||||||
|
|
||||||
|
// StreamingCredentialsProvider is used to retrieve the credentials
|
||||||
|
// for the connection from an external source. Those credentials may change
|
||||||
|
// during the connection lifetime. This is useful for managed identity
|
||||||
|
// scenarios where the credentials are retrieved from an external source.
|
||||||
|
//
|
||||||
|
// Currently, this is a placeholder for the future implementation.
|
||||||
|
StreamingCredentialsProvider auth.StreamingCredentialsProvider
|
||||||
|
|
||||||
// DB is the database to be selected after connecting to the server.
|
// DB is the database to be selected after connecting to the server.
|
||||||
DB int
|
DB int
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/redis/go-redis/v9/auth"
|
||||||
"github.com/redis/go-redis/v9/internal"
|
"github.com/redis/go-redis/v9/internal"
|
||||||
"github.com/redis/go-redis/v9/internal/hashtag"
|
"github.com/redis/go-redis/v9/internal/hashtag"
|
||||||
"github.com/redis/go-redis/v9/internal/pool"
|
"github.com/redis/go-redis/v9/internal/pool"
|
||||||
@ -66,11 +67,12 @@ type ClusterOptions struct {
|
|||||||
|
|
||||||
OnConnect func(ctx context.Context, cn *Conn) error
|
OnConnect func(ctx context.Context, cn *Conn) error
|
||||||
|
|
||||||
Protocol int
|
Protocol int
|
||||||
Username string
|
Username string
|
||||||
Password string
|
Password string
|
||||||
CredentialsProvider func() (username string, password string)
|
CredentialsProvider func() (username string, password string)
|
||||||
CredentialsProviderContext func(ctx context.Context) (username string, password string, err error)
|
CredentialsProviderContext func(ctx context.Context) (username string, password string, err error)
|
||||||
|
StreamingCredentialsProvider auth.StreamingCredentialsProvider
|
||||||
|
|
||||||
MaxRetries int
|
MaxRetries int
|
||||||
MinRetryBackoff time.Duration
|
MinRetryBackoff time.Duration
|
||||||
@ -291,11 +293,12 @@ func (opt *ClusterOptions) clientOptions() *Options {
|
|||||||
Dialer: opt.Dialer,
|
Dialer: opt.Dialer,
|
||||||
OnConnect: opt.OnConnect,
|
OnConnect: opt.OnConnect,
|
||||||
|
|
||||||
Protocol: opt.Protocol,
|
Protocol: opt.Protocol,
|
||||||
Username: opt.Username,
|
Username: opt.Username,
|
||||||
Password: opt.Password,
|
Password: opt.Password,
|
||||||
CredentialsProvider: opt.CredentialsProvider,
|
CredentialsProvider: opt.CredentialsProvider,
|
||||||
CredentialsProviderContext: opt.CredentialsProviderContext,
|
CredentialsProviderContext: opt.CredentialsProviderContext,
|
||||||
|
StreamingCredentialsProvider: opt.StreamingCredentialsProvider,
|
||||||
|
|
||||||
MaxRetries: opt.MaxRetries,
|
MaxRetries: opt.MaxRetries,
|
||||||
MinRetryBackoff: opt.MinRetryBackoff,
|
MinRetryBackoff: opt.MinRetryBackoff,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user