distribution/distribution

redisTLS configuration support when using go-redis

MinerYang opened this issue · 2 comments

Description

I have noticed that there's a PR added redisTLS configurations support before when still using redigo library.
But seems be ingore when migrating go go-redis by this commit .

  • Since we already have configuration for redisTLS, we should add this to createPoolwhen new Redis client
  • Besides, could we consider to add something likeRedis.TLS.CaCert to allow users connect with certs.
func (app *App) createPool(cfg configuration.Redis) *redis.Client {
	return redis.NewClient(&redis.Options{
		Addr: cfg.Addr,
		OnConnect: func(ctx context.Context, cn *redis.Conn) error {
			res := cn.Ping(ctx)
			return res.Err()
		},
		Username:        cfg.Username,
		...
                TLSConfig:       cfg.TLS
	})
}

Great catch, thanks. Would you be willing to open a PR? I think we might need 2 PRs actually

  • fix the TLS when creating a new pool (bugfix)
  • add configuration support for custom CAs

Closing, addressed in #4306