-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.go
52 lines (45 loc) · 1.2 KB
/
index.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
package definations
import (
"strings"
)
// TLSOptions options about TLS
type TLSOptions struct {
Enabled bool `yaml:"enabled"`
CertFile string `yaml:"certFile"`
KeyFile string `yaml:"keyFile"`
CaFile string `yaml:"caFile"`
SkipVerify bool `yaml:"skipVerify"`
VerifyClient bool `yaml:"verifyClient"`
}
// Proxies options about http proxy
type Proxies struct {
HTTP string `yaml:"http"`
HTTPS string `yaml:"https"`
}
// Valid check if proxies configuration is valid
func (n *Proxies) Valid() bool {
return n.HTTP != "" || n.HTTPS != ""
}
// GetProxyURL fetch proxy url by any configured http or https
func (n *Proxies) GetProxyURL() string {
if "" == n.HTTP {
return n.HTTPS
}
return n.HTTP
}
// FetchProxyURL fetch proxy url
func (n *Proxies) FetchProxyURL(endpointURL string) string {
if strings.HasPrefix(endpointURL, "https") {
return n.HTTPS
}
return n.HTTP
}
// DBConnectorConfig db connector configuration
type DBConnectorConfig struct {
Driver string `yaml:"driver"`
Address string `yaml:"address"`
Db string `yaml:"db"`
Mechanism string `yaml:"mechanism"`
TablePrefix string `yaml:"tablePrefix"`
SSHTunnelDSN string `yaml:"sshTunnel"`
}