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