Compare commits
No commits in common. "136c4634c88632e24cc4b06312248a0d594fbc38" and "02d8a509ffc81ab88cbb09d6eb9b3417e69dc465" have entirely different histories.
136c4634c8
...
02d8a509ff
@ -6,7 +6,7 @@ type Redis struct {
|
||||
DB int `mapstructure:"db"`
|
||||
Username string `mapstructure:"username"`
|
||||
Password string `mapstructure:"password"`
|
||||
SSL bool `mapstructure:"ssl"`
|
||||
SslMode string `mapstructure:"ssl-mode"`
|
||||
Debug bool `mapstructure:"debug"`
|
||||
MaxIdleConnectionsInSecond int `mapstructure:"max-idle-connections-in-second"`
|
||||
MaxOpenConnectionsInSecond int `mapstructure:"max-open-connections-in-second"`
|
||||
|
||||
2
env/debug.yaml
vendored
2
env/debug.yaml
vendored
@ -36,7 +36,7 @@ redis:
|
||||
username: red-d046l42dbo4c73ea9iag
|
||||
password: 7cZvu08JKuO9MPNxBb97tZCVNj0ZGNp2
|
||||
db: 5
|
||||
ssl: true
|
||||
ssl: false
|
||||
max-idle-connections-in-second: 600
|
||||
max-open-connections-in-second: 600
|
||||
connection-max-life-time-in-second: 600
|
||||
|
||||
2
env/staging.yaml
vendored
2
env/staging.yaml
vendored
@ -36,7 +36,7 @@ redis:
|
||||
username: red-d04c8k49c44c739ga8dg
|
||||
password: ItPzniHv94yr8vY4HTrhCfKoibqBh61T
|
||||
db: 5
|
||||
ssl: true
|
||||
ssl: false
|
||||
max-idle-connections-in-second: 600
|
||||
max-open-connections-in-second: 600
|
||||
connection-max-life-time-in-second: 600
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package redisaccessor
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"legalgo-BE-go/config"
|
||||
|
||||
@ -17,19 +16,11 @@ func Get() *redis.Client {
|
||||
func New(cfg *config.Config) *redis.Client {
|
||||
addr := fmt.Sprintf("%s:%s", cfg.Redis.Host, cfg.Redis.Port)
|
||||
|
||||
options := &redis.Options{
|
||||
redisClient = redis.NewClient(&redis.Options{
|
||||
Addr: addr,
|
||||
Password: cfg.Redis.Password,
|
||||
DB: cfg.Redis.DB,
|
||||
}
|
||||
})
|
||||
|
||||
if cfg.Redis.Username != "" {
|
||||
options.Username = cfg.Redis.Username
|
||||
}
|
||||
if cfg.Redis.SSL {
|
||||
options.TLSConfig = &tls.Config{}
|
||||
}
|
||||
|
||||
redisClient = redis.NewClient(options)
|
||||
return redisClient
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user