mirror of https://github.com/status-im/consul.git
Add agent service Address field to the api
The Address field was introduced in #570. This patch extends this to the api.
This commit is contained in:
parent
d478f786db
commit
a85575dcaa
14
api/agent.go
14
api/agent.go
|
@ -22,6 +22,7 @@ type AgentService struct {
|
||||||
Service string
|
Service string
|
||||||
Tags []string
|
Tags []string
|
||||||
Port int
|
Port int
|
||||||
|
Address string
|
||||||
}
|
}
|
||||||
|
|
||||||
// AgentMember represents a cluster member known to the agent
|
// AgentMember represents a cluster member known to the agent
|
||||||
|
@ -41,12 +42,13 @@ type AgentMember struct {
|
||||||
|
|
||||||
// AgentServiceRegistration is used to register a new service
|
// AgentServiceRegistration is used to register a new service
|
||||||
type AgentServiceRegistration struct {
|
type AgentServiceRegistration struct {
|
||||||
ID string `json:",omitempty"`
|
ID string `json:",omitempty"`
|
||||||
Name string `json:",omitempty"`
|
Name string `json:",omitempty"`
|
||||||
Tags []string `json:",omitempty"`
|
Tags []string `json:",omitempty"`
|
||||||
Port int `json:",omitempty"`
|
Port int `json:",omitempty"`
|
||||||
Check *AgentServiceCheck
|
Address string `json:",omitempty"`
|
||||||
Checks AgentServiceChecks
|
Check *AgentServiceCheck
|
||||||
|
Checks AgentServiceChecks
|
||||||
}
|
}
|
||||||
|
|
||||||
// AgentCheckRegistration is used to register a new check
|
// AgentCheckRegistration is used to register a new check
|
||||||
|
|
|
@ -45,9 +45,10 @@ func TestAgent_Services(t *testing.T) {
|
||||||
agent := c.Agent()
|
agent := c.Agent()
|
||||||
|
|
||||||
reg := &AgentServiceRegistration{
|
reg := &AgentServiceRegistration{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Tags: []string{"bar", "baz"},
|
Tags: []string{"bar", "baz"},
|
||||||
Port: 8000,
|
Port: 8000,
|
||||||
|
Address: "192.168.0.42",
|
||||||
Check: &AgentServiceCheck{
|
Check: &AgentServiceCheck{
|
||||||
TTL: "15s",
|
TTL: "15s",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue