enhancement(redis): add TLSConfig (#261)

* TLSConfig

* Update README.md

* add tls tests and certs

* Update test-redis.yml

* Update test-redis.yml

* Update test-redis.yml

* Update test-redis.yml

* Update test-redis.yml

correct tls port

* Update test-redis.yml

path

* Update test-redis.yml
This commit is contained in:
Jason McNeil
2022-01-09 17:48:57 -04:00
committed by GitHub
parent 2728ec3c02
commit 842a366c10
17 changed files with 415 additions and 37 deletions

View File

@@ -25,15 +25,17 @@ func New(config ...Config) *Storage {
if cfg.URL != "" {
options, err = redis.ParseURL(cfg.URL)
options.TLSConfig = cfg.TLSConfig
if err != nil {
panic(err)
}
} else {
options = &redis.Options{
Addr: fmt.Sprintf("%s:%d", cfg.Host, cfg.Port),
DB: cfg.Database,
Username: cfg.Username,
Password: cfg.Password,
Addr: fmt.Sprintf("%s:%d", cfg.Host, cfg.Port),
DB: cfg.Database,
Username: cfg.Username,
Password: cfg.Password,
TLSConfig: cfg.TLSConfig,
}
}