distribution icon indicating copy to clipboard operation
distribution copied to clipboard

redisTLS configuration support when using go-redis

Open MinerYang opened this issue 1 year ago • 1 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
	})
}

MinerYang avatar Feb 23 '24 05:02 MinerYang

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

milosgajdos avatar Mar 02 '24 08:03 milosgajdos

Closing, addressed in https://github.com/distribution/distribution/pull/4306

milosgajdos avatar Jul 04 '24 15:07 milosgajdos