-
Notifications
You must be signed in to change notification settings - Fork 2
/
consul.go
38 lines (32 loc) · 828 Bytes
/
consul.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
package config
// ConsulConfig consul 配置
type ConsulConfig interface {
GetEnabled() bool
GetDockerHost() string
GetPort() int
GetHost() string
}
// defaultConsulConfig 默认consul 配置
type defaultConsulConfig struct {
Enabled bool `json:"enabled"`
Host string `json:"host"`
DockerHost string `json:"docker_host"`
Port int `json:"port"`
Kv_location string `json:"kv_location"`
}
// GetPort consul 端口
func (c defaultConsulConfig) GetPort() int {
return c.Port
}
// GetEnabled consul 激活
func (c defaultConsulConfig) GetEnabled() bool {
return c.Enabled
}
// GetHost consul 主机地址
func (c defaultConsulConfig) GetHost() string {
return c.Host
}
// GetDockerHost consul 获取docker环境的
func (c defaultConsulConfig) GetDockerHost() string {
return c.DockerHost
}