-
Notifications
You must be signed in to change notification settings - Fork 14
/
default.go
58 lines (53 loc) · 1.2 KB
/
default.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
package config
const (
_httpScheme = "http"
_schemeSpliterator = "://"
_defaultConfigFilename = "config.yml"
_corePrefix = "CORE"
// default app port.
DefaultAppPort = 6789
// default app id.
DefaultAppID = "core"
// assume single node.
DefaultName = "core"
)
var (
_defaultProxy = Proxy{
Name: "core.proxy",
HTTPPort: 7000,
GRPCPort: 7001,
}
_defaultAppServer = Server{
Name: DefaultName,
AppID: DefaultAppID,
AppPort: DefaultAppPort,
}
_defaultLogConfig = LogConfig{
Level: "INFO",
Encoding: "json",
}
_defaultUseSearchEngine = "elasticsearch"
_defaultESConfig = ESConfig{
Endpoints: []string{"http://localhost:9200"},
Username: "admin",
Password: "admin",
}
_defaultEtcdConfig = EtcdConfig{
DialTimeout: 3,
Endpoints: []string{"http://localhost:2379"},
}
_defaultDiscovery = Discovery{
HeartTime: 3,
DialTimeout: 3,
Endpoints: []string{"http://localhost:2379"},
}
)
func SetDefaultEtcd(etcdBrokers []string) {
if len(etcdBrokers) > 0 {
_defaultEtcdConfig.Endpoints = etcdBrokers
_defaultDiscovery.Endpoints = etcdBrokers
}
}
func SetDefaultES(esBrokers []string) {
_defaultESConfig.Endpoints = esBrokers
}