Compare commits
17
Commits
0bf6d57eb2
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
211f0154be | ||
|
|
136c4634c8 | ||
|
|
987ac2fe4a | ||
|
|
02d8a509ff | ||
|
|
e29bd7986f | ||
|
|
4bf318a9c2 | ||
|
|
52085a5be0 | ||
|
|
21c4c1efba | ||
|
|
c17540cc20 | ||
|
|
714b1ff4eb | ||
|
|
abc3ce8d2b | ||
|
|
cd1097d3d0 | ||
|
|
52991059c6 | ||
|
|
a7ef3f8ca2 | ||
|
|
6f1ac37915 | ||
|
|
e20c63e694 | ||
|
|
abcbc014a2 |
+5
-4
@@ -12,14 +12,15 @@ import (
|
||||
const (
|
||||
YAML_PATH = "env/%s"
|
||||
ENV_MODE = "ENV_MODE"
|
||||
DEFAULT_ENV_MODE = "development"
|
||||
DEFAULT_ENV_MODE = "local"
|
||||
)
|
||||
|
||||
var (
|
||||
validEnvMode = map[string]struct{}{
|
||||
"local": {},
|
||||
"development": {},
|
||||
"production": {},
|
||||
"local": {},
|
||||
"staging": {},
|
||||
"production": {},
|
||||
"debug": {},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ type Redis struct {
|
||||
DB int `mapstructure:"db"`
|
||||
Username string `mapstructure:"username"`
|
||||
Password string `mapstructure:"password"`
|
||||
SslMode string `mapstructure:"ssl-mode"`
|
||||
SSL bool `mapstructure:"ssl"`
|
||||
Debug bool `mapstructure:"debug"`
|
||||
MaxIdleConnectionsInSecond int `mapstructure:"max-idle-connections-in-second"`
|
||||
MaxOpenConnectionsInSecond int `mapstructure:"max-open-connections-in-second"`
|
||||
|
||||
+2
-1
@@ -15,12 +15,13 @@ type DB struct {
|
||||
|
||||
func NewDB(cfg *config.Config) (*DB, error) {
|
||||
dsn := fmt.Sprintf(
|
||||
"host=%s user=%s password=%s dbname=%s port=%v sslmode=disable",
|
||||
"host=%s user=%s password=%s dbname=%s port=%v sslmode=%s",
|
||||
cfg.Database.Host,
|
||||
cfg.Database.Username,
|
||||
cfg.Database.Password,
|
||||
cfg.Database.DB,
|
||||
cfg.Database.Port,
|
||||
cfg.Database.SslMode,
|
||||
)
|
||||
|
||||
if dsn == "" {
|
||||
|
||||
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
server:
|
||||
base-url: https://api.legalgo.id/core
|
||||
local-url: http://localhost:3300
|
||||
port: 3300
|
||||
|
||||
jwt:
|
||||
token:
|
||||
expires-ttl: 1440
|
||||
secret: "5Lm25V3Qd7aut8dr4QUxm5PZUrSFs"
|
||||
|
||||
postgresql:
|
||||
host: dpg-d046h549c44c739arfv0-a.singapore-postgres.render.com
|
||||
port: 5432
|
||||
driver: postgres
|
||||
db: legalgonews_prod
|
||||
username: legalgo_admin
|
||||
password: "656ogwc0JlLEVQyHnT5RrrYa7762iBQQ"
|
||||
ssl-mode: require
|
||||
max-idle-connections-in-second: 600
|
||||
max-open-connections-in-second: 600
|
||||
connection-max-life-time-in-second: 600
|
||||
debug: false
|
||||
|
||||
oss:
|
||||
access_key_id: GTK7i3SVy9llQeGH0Htv
|
||||
access_key_secret: 2psmKXZFpevA9n5ntSDRMqFBpZuSz32dvtXjYclf
|
||||
endpoint: news-cdn.legalgo.id
|
||||
bucket_name: uploads
|
||||
log_level: Error
|
||||
host_url: https://news-cdn.legalgo.id
|
||||
public_url: https://news-cdn.legalgo.id
|
||||
|
||||
redis:
|
||||
host: singapore-keyvalue.render.com
|
||||
port: 6379
|
||||
username: red-d046l42dbo4c73ea9iag
|
||||
password: 7cZvu08JKuO9MPNxBb97tZCVNj0ZGNp2
|
||||
db: 5
|
||||
ssl: true
|
||||
max-idle-connections-in-second: 600
|
||||
max-open-connections-in-second: 600
|
||||
connection-max-life-time-in-second: 600
|
||||
debug: false
|
||||
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
server:
|
||||
base-url: https://api.legalgo.id/core
|
||||
local-url: http://localhost:3300
|
||||
port: 3300
|
||||
|
||||
jwt:
|
||||
token:
|
||||
expires-ttl: 1440
|
||||
secret: "5Lm25V3Qd7aut8dr4QUxm5PZUrSFs"
|
||||
|
||||
postgresql:
|
||||
host: dpg-d04bi9juibrs73augcc0-a.singapore-postgres.render.com
|
||||
port: 5432
|
||||
driver: postgres
|
||||
db: legalgonews_dev
|
||||
username: legalgo_admin
|
||||
password: "5h7DCBR1T8pug6AlbrHXqIDAr9o2vnky"
|
||||
ssl-mode: require
|
||||
max-idle-connections-in-second: 600
|
||||
max-open-connections-in-second: 600
|
||||
connection-max-life-time-in-second: 600
|
||||
debug: false
|
||||
|
||||
oss:
|
||||
access_key_id: GTK7i3SVy9llQeGH0Htv
|
||||
access_key_secret: 2psmKXZFpevA9n5ntSDRMqFBpZuSz32dvtXjYclf
|
||||
endpoint: news-cdn.legalgo.id
|
||||
bucket_name: uploads-staging
|
||||
log_level: Error
|
||||
host_url: https://news-cdn.legalgo.id
|
||||
public_url: https://news-cdn.legalgo.id
|
||||
|
||||
redis:
|
||||
host: singapore-keyvalue.render.com
|
||||
port: 6379
|
||||
username: red-d04c8k49c44c739ga8dg
|
||||
password: ItPzniHv94yr8vY4HTrhCfKoibqBh61T
|
||||
db: 5
|
||||
ssl: true
|
||||
max-idle-connections-in-second: 600
|
||||
max-open-connections-in-second: 600
|
||||
connection-max-life-time-in-second: 600
|
||||
debug: false
|
||||
+13
-13
@@ -9,12 +9,12 @@ jwt:
|
||||
secret: "5Lm25V3Qd7aut8dr4QUxm5PZUrSFs"
|
||||
|
||||
postgresql:
|
||||
host: 62.72.45.250
|
||||
port: 20826
|
||||
host: dpg-d046h549c44c739arfv0-a
|
||||
port: 5432
|
||||
driver: postgres
|
||||
db: legalgonews-dev
|
||||
db: legalgonews_prod
|
||||
username: legalgo_admin
|
||||
password: "K4K!2Kg7c@KW6H&4A2aBy2dFCRY3Sh"
|
||||
password: "656ogwc0JlLEVQyHnT5RrrYa7762iBQQ"
|
||||
ssl-mode: disable
|
||||
max-idle-connections-in-second: 600
|
||||
max-open-connections-in-second: 600
|
||||
@@ -22,18 +22,18 @@ postgresql:
|
||||
debug: false
|
||||
|
||||
oss:
|
||||
access_key_id: cf9a475e18bc7626cbdbf09709d82a64
|
||||
access_key_secret: 91f3321294d3e23035427a0ecb893ada
|
||||
endpoint: sin1.contabostorage.com
|
||||
bucket_name: legalgonews-dev
|
||||
access_key_id: GTK7i3SVy9llQeGH0Htv
|
||||
access_key_secret: 2psmKXZFpevA9n5ntSDRMqFBpZuSz32dvtXjYclf
|
||||
endpoint: news-cdn.legalgo.id
|
||||
bucket_name: uploads
|
||||
log_level: Error
|
||||
host_url: https://sin1.contabostorage.com
|
||||
public_url: https://sin1.contabostorage.com/fda98c2228f246f29a7e466b86b3b9e7
|
||||
host_url: https://news-cdn.legalgo.id
|
||||
public_url: https://news-cdn.legalgo.id
|
||||
|
||||
redis:
|
||||
host: 62.72.45.250
|
||||
port: 26379
|
||||
password: mDtpsyEW8W26vwLhglpO
|
||||
host: red-d046l42dbo4c73ea9iag
|
||||
port: 6379
|
||||
password: 7cZvu08JKuO9MPNxBb97tZCVNj0ZGNp2
|
||||
db: 5
|
||||
ssl: false
|
||||
max-idle-connections-in-second: 600
|
||||
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
server:
|
||||
base-url: https://api.legalgo.id/core
|
||||
local-url: http://localhost:3300
|
||||
port: 3300
|
||||
|
||||
jwt:
|
||||
token:
|
||||
expires-ttl: 1440
|
||||
secret: "5Lm25V3Qd7aut8dr4QUxm5PZUrSFs"
|
||||
|
||||
postgresql:
|
||||
host: dpg-d04bi9juibrs73augcc0-a
|
||||
port: 5432
|
||||
driver: postgres
|
||||
db: legalgonews_dev
|
||||
username: legalgo_admin
|
||||
password: "5h7DCBR1T8pug6AlbrHXqIDAr9o2vnky"
|
||||
ssl-mode: disable
|
||||
max-idle-connections-in-second: 600
|
||||
max-open-connections-in-second: 600
|
||||
connection-max-life-time-in-second: 600
|
||||
debug: false
|
||||
|
||||
oss:
|
||||
access_key_id: GTK7i3SVy9llQeGH0Htv
|
||||
access_key_secret: 2psmKXZFpevA9n5ntSDRMqFBpZuSz32dvtXjYclf
|
||||
endpoint: news-cdn.legalgo.id
|
||||
bucket_name: uploads-staging
|
||||
log_level: Error
|
||||
host_url: https://news-cdn.legalgo.id
|
||||
public_url: https://news-cdn.legalgo.id
|
||||
|
||||
redis:
|
||||
host: red-d04c8k49c44c739ga8dg
|
||||
port: 6379
|
||||
password: ItPzniHv94yr8vY4HTrhCfKoibqBh61T
|
||||
db: 5
|
||||
ssl: false
|
||||
max-idle-connections-in-second: 600
|
||||
max-open-connections-in-second: 600
|
||||
connection-max-life-time-in-second: 600
|
||||
debug: false
|
||||
@@ -66,7 +66,7 @@ func (r *OssRepositoryImpl) GetPublicURL(fileName string) string {
|
||||
if fileName == "" {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("%s:%s%s", r.cfg.GetPublicURL(), r.cfg.GetBucketName(), fileName)
|
||||
return fmt.Sprintf("%s/%s%s", r.cfg.GetPublicURL(), r.cfg.GetBucketName(), fileName)
|
||||
}
|
||||
|
||||
func (r *OssRepositoryImpl) DeleteObject(ctx context.Context, fileName string) error {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package redisaccessor
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"legalgo-BE-go/config"
|
||||
|
||||
@@ -16,11 +17,19 @@ func Get() *redis.Client {
|
||||
func New(cfg *config.Config) *redis.Client {
|
||||
addr := fmt.Sprintf("%s:%s", cfg.Redis.Host, cfg.Redis.Port)
|
||||
|
||||
redisClient = redis.NewClient(&redis.Options{
|
||||
options := &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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user