Compare commits
4
Commits
e29bd7986f
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
211f0154be | ||
|
|
136c4634c8 | ||
|
|
987ac2fe4a | ||
|
|
02d8a509ff |
+1
-1
@@ -12,7 +12,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
YAML_PATH = "env/%s"
|
YAML_PATH = "env/%s"
|
||||||
ENV_MODE = "ENV_MODE"
|
ENV_MODE = "ENV_MODE"
|
||||||
DEFAULT_ENV_MODE = "staging"
|
DEFAULT_ENV_MODE = "local"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
+1
-1
@@ -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"`
|
||||||
SslMode string `mapstructure:"ssl-mode"`
|
SSL bool `mapstructure:"ssl"`
|
||||||
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"`
|
||||||
|
|||||||
Vendored
+1
-1
@@ -36,7 +36,7 @@ redis:
|
|||||||
username: red-d046l42dbo4c73ea9iag
|
username: red-d046l42dbo4c73ea9iag
|
||||||
password: 7cZvu08JKuO9MPNxBb97tZCVNj0ZGNp2
|
password: 7cZvu08JKuO9MPNxBb97tZCVNj0ZGNp2
|
||||||
db: 5
|
db: 5
|
||||||
ssl: false
|
ssl: true
|
||||||
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
|
||||||
|
|||||||
Vendored
+16
-15
@@ -9,33 +9,34 @@ jwt:
|
|||||||
secret: "5Lm25V3Qd7aut8dr4QUxm5PZUrSFs"
|
secret: "5Lm25V3Qd7aut8dr4QUxm5PZUrSFs"
|
||||||
|
|
||||||
postgresql:
|
postgresql:
|
||||||
host: 62.72.45.250
|
host: dpg-d04bi9juibrs73augcc0-a.singapore-postgres.render.com
|
||||||
port: 20826
|
port: 5432
|
||||||
driver: postgres
|
driver: postgres
|
||||||
db: legalgonews-dev
|
db: legalgonews_dev
|
||||||
username: legalgo_admin
|
username: legalgo_admin
|
||||||
password: "K4K!2Kg7c@KW6H&4A2aBy2dFCRY3Sh"
|
password: "5h7DCBR1T8pug6AlbrHXqIDAr9o2vnky"
|
||||||
ssl-mode: disable
|
ssl-mode: require
|
||||||
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
|
||||||
debug: false
|
debug: false
|
||||||
|
|
||||||
oss:
|
oss:
|
||||||
access_key_id: cf9a475e18bc7626cbdbf09709d82a64
|
access_key_id: GTK7i3SVy9llQeGH0Htv
|
||||||
access_key_secret: 91f3321294d3e23035427a0ecb893ada
|
access_key_secret: 2psmKXZFpevA9n5ntSDRMqFBpZuSz32dvtXjYclf
|
||||||
endpoint: sin1.contabostorage.com
|
endpoint: news-cdn.legalgo.id
|
||||||
bucket_name: legalgonews-dev
|
bucket_name: uploads-staging
|
||||||
log_level: Error
|
log_level: Error
|
||||||
host_url: https://sin1.contabostorage.com
|
host_url: https://news-cdn.legalgo.id
|
||||||
public_url: https://sin1.contabostorage.com/fda98c2228f246f29a7e466b86b3b9e7
|
public_url: https://news-cdn.legalgo.id
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
host: 62.72.45.250
|
host: singapore-keyvalue.render.com
|
||||||
port: 26379
|
port: 6379
|
||||||
password: mDtpsyEW8W26vwLhglpO
|
username: red-d04c8k49c44c739ga8dg
|
||||||
|
password: ItPzniHv94yr8vY4HTrhCfKoibqBh61T
|
||||||
db: 5
|
db: 5
|
||||||
ssl: false
|
ssl: true
|
||||||
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
|
||||||
|
|||||||
Vendored
+4
-5
@@ -9,13 +9,13 @@ jwt:
|
|||||||
secret: "5Lm25V3Qd7aut8dr4QUxm5PZUrSFs"
|
secret: "5Lm25V3Qd7aut8dr4QUxm5PZUrSFs"
|
||||||
|
|
||||||
postgresql:
|
postgresql:
|
||||||
host: dpg-d04bi9juibrs73augcc0-a.singapore-postgres.render.com
|
host: dpg-d04bi9juibrs73augcc0-a
|
||||||
port: 5432
|
port: 5432
|
||||||
driver: postgres
|
driver: postgres
|
||||||
db: legalgonews_dev
|
db: legalgonews_dev
|
||||||
username: legalgo_admin
|
username: legalgo_admin
|
||||||
password: "5h7DCBR1T8pug6AlbrHXqIDAr9o2vnky"
|
password: "5h7DCBR1T8pug6AlbrHXqIDAr9o2vnky"
|
||||||
ssl-mode: require
|
ssl-mode: disable
|
||||||
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
|
||||||
@@ -31,10 +31,9 @@ oss:
|
|||||||
public_url: https://news-cdn.legalgo.id
|
public_url: https://news-cdn.legalgo.id
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
host: singapore-keyvalue.render.com
|
host: red-d04c8k49c44c739ga8dg
|
||||||
port: 6379
|
port: 6379
|
||||||
username: red-d04bhi49c44c739fk91g
|
password: ItPzniHv94yr8vY4HTrhCfKoibqBh61T
|
||||||
password: KncWOoEiJXOSycCWBxMQECpWmYm76vew
|
|
||||||
db: 5
|
db: 5
|
||||||
ssl: false
|
ssl: false
|
||||||
max-idle-connections-in-second: 600
|
max-idle-connections-in-second: 600
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package redisaccessor
|
package redisaccessor
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"legalgo-BE-go/config"
|
"legalgo-BE-go/config"
|
||||||
|
|
||||||
@@ -16,11 +17,19 @@ 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)
|
||||||
|
|
||||||
redisClient = redis.NewClient(&redis.Options{
|
options := &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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user