Browse Source

fix: 增加一个用户信息接口 (#793)

一叶知秋 1 năm trước cách đây
mục cha
commit
c22a036b7f
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  1. 2 0
      cache/redis.go

+ 2 - 0
cache/redis.go

@@ -16,6 +16,7 @@ type Redis struct {
 // RedisOpts redis 连接属性
 type RedisOpts struct {
 	Host        string `yml:"host" json:"host"`
+	Username    string `yaml:"username" json:"username"`
 	Password    string `yml:"password" json:"password"`
 	Database    int    `yml:"database" json:"database"`
 	MaxIdle     int    `yml:"max_idle" json:"max_idle"`
@@ -28,6 +29,7 @@ func NewRedis(ctx context.Context, opts *RedisOpts) *Redis {
 	conn := redis.NewUniversalClient(&redis.UniversalOptions{
 		Addrs:        []string{opts.Host},
 		DB:           opts.Database,
+		Username:     opts.Username,
 		Password:     opts.Password,
 		IdleTimeout:  time.Second * time.Duration(opts.IdleTimeout),
 		MinIdleConns: opts.MaxIdle,