-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration.go
134 lines (118 loc) · 3.62 KB
/
configuration.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package conf
import "time"
// GlobalConfigs var
var GlobalConfigs GlobalConfiguration
// GlobalConfiguration holds all the global configuration for gocommerce
type GlobalConfiguration struct {
Environment string `yaml:"environment"`
GRPC struct {
Host string `yaml:"grpc.host"`
Port string `yaml:"grpc.port"`
Endpoint string `yaml:"grpc.endpoint"`
}
HTTP struct {
Host string `yaml:"http.host"`
Port string `yaml:"http.port"`
Endpoint string `yaml:"http.endpoint"`
}
DEBUG struct {
Host string `yaml:"debug.host"`
Port string `yaml:"debug.port"`
Endpoint string `yaml:"debug.endpoint"`
}
Redis RedisConfiguration
Vault VaultConfiguration
MultiInstanceMode bool `yaml:"multiInstanceMode"`
Log LoggingConfig
Service Service
Jaeger Jaeger
Kafka Kafka
Notif Notif
}
// RedisConfiguration struct
type RedisConfiguration struct {
Username string `yaml:"redis.username"`
Password string `yaml:"redis.password"`
DB int `yaml:"redis.db"`
Host string `yaml:"redis.host"`
Logger bool `yaml:"redis.logger"`
}
// VaultConfiguration struct
type VaultConfiguration struct {
Address string `yaml:"vault.address"`
Token string `yaml:"vault.token"`
}
// LoggingConfig struct
type LoggingConfig struct {
DisableColors bool `json:"disable_colors" yaml:"log.disableColors"`
QuoteEmptyFields bool `json:"quote_empty_fields" yaml:"log.quoteEmptyFields"`
}
// Service details
type Service struct {
Name string `yaml:"service.name"`
// min code lenght
MinCL int `yaml:"service.mincl"`
MaxCl int `yaml:"service.maxcl"`
Redis struct {
SMSDuration time.Duration `yaml:"service.redis.smsDuration"`
SMSCodeVerification time.Duration `yaml:"service.redis.smsCodeVerification"`
UserDuration time.Duration `yaml:"service.redis.userDuration"`
}
}
// Jaeger tracer
type Jaeger struct {
HostPort string `yaml:"jaeger.hostPort"`
LogSpans bool `yaml:"jaeger.logSpans"`
}
// Kafka struct
type Kafka struct {
Username string `yaml:"kafka.username"`
Password string `yaml:"kafka.password"`
Brokers []string `yaml:"kafka.brokers"`
Version string `yaml:"kafka.version"`
Group string `yaml:"kafka.group"`
Assignor string `yaml:"kafka.assignor"`
Oldest bool `yaml:"kafka.oldest"`
Verbose bool `yaml:"kafka.verbose"`
Topics Topic `yaml:"kafka.topics"`
Auth bool `yaml:"kafka.auth"`
Consumer bool `yaml:"kafka.consumer"`
Producer bool `yaml:"kafka.producer"`
}
// Topic struct
type Topic struct {
Notif string `yaml:"kafka.topics.notif"`
}
// Notif struct
type Notif struct {
SMS sms
Email email
}
type sms struct {
UserAPIKey string `yaml:"notif.sms.userApiKey"`
SecretKey string `yaml:"notif.sms.secretKey"`
Token struct {
URL string `yaml:"notif.sms.token.url"`
ContentType string `yaml:"notif.sms.token.contentType"`
}
Send struct {
TemplateURL string `yaml:"notif.sms.send.templateURL"`
BodyURL string `yaml:"notif.sms.send.bodyURL"`
LineNumber []string `yaml:"notif.sms.send.lineNumber"`
Verify struct {
TemplateID string `yaml:"notif.sms.send.verify.templateId"`
ContentType string `yaml:"notif.sms.send.verify.contentType"`
}
}
}
type email struct {
Driver string `yaml:"notif.email.driver"`
Host string `yaml:"notif.email.host"`
Port int `yaml:"notif.email.port"`
Username string `yaml:"notif.email.username"`
Password string `yaml:"notif.email.password"`
Identity string `yaml:"notif.email.identity"`
Send struct {
Template string `yaml:"notif.email.send.template"`
}
}