/
sys.go
55 lines (51 loc) · 1.15 KB
/
sys.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package sys
import (
"github.com/go-redis/redis/v8"
"go.uber.org/zap"
"time"
"go.mongodb.org/mongo-driver/mongo"
)
// Configs contains all the configs gathered from env vars
var Configs struct {
IdempotencyEnabled bool
Http struct {
Port string
ShutdownTimeout time.Duration
ReadTimeout time.Duration
WriteTimeout time.Duration
IdleTimeout time.Duration
}
Swagger struct {
Protocol string
Host string
}
Mongo struct {
Database string
ConnectionURL string
ConnectionTimeout time.Duration
DisconnectTimeout time.Duration
PingTimeout time.Duration
OperationTimeout time.Duration
}
Redis struct {
ConnectionURL string
User string
Pass string
PingTimeout time.Duration
OperationTimeout time.Duration
CacheTTL time.Duration
}
NewRelic struct {
AppName string
Licence string
Enabled bool
ConnectionTimeout time.Duration
ShutdownTimeout time.Duration
}
}
// S holds static resources across the project
var S struct {
Log *zap.SugaredLogger
Mongo *mongo.Client
Redis *redis.Client
}