-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodels.go
More file actions
44 lines (38 loc) · 878 Bytes
/
models.go
File metadata and controls
44 lines (38 loc) · 878 Bytes
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
package main
import (
"net/url"
"github.com/mhenderson-so/haproxyctl/cmd/haproxyctl"
)
type HAProxyCtlConfig struct {
DefaultUsername string
DefaultPassword string
LoadBalancers []LoadBalancer
}
type LoadBalancer struct {
Name string
Url string
Username string
Password string
HAProxyCtl haproxyctl.HAProxyConfig
}
func (c *HAProxyCtlConfig) ProcessInit() {
for i, x := range c.LoadBalancers {
thisUsername := x.Username
if thisUsername == "" {
thisUsername = c.DefaultUsername
}
thisPassword := x.Password
if thisPassword == "" {
thisPassword = c.DefaultPassword
}
thisURL, _ := url.Parse(x.Url)
c.LoadBalancers[i].HAProxyCtl = haproxyctl.HAProxyConfig{
Username: thisUsername,
Password: thisPassword,
URL: *thisURL,
}
}
}
const (
ActionGetDetail = "get"
)