add ttl placeholder to discovery

Signed-off-by: Victor Vieux <victorvieux@gmail.com>
This commit is contained in:
Victor Vieux 2015-06-10 17:03:48 -07:00
parent 91b599407f
commit 52db3436a2
2 changed files with 4 additions and 4 deletions

View File

@ -10,11 +10,11 @@ The discovery service is still in alpha stage and currently hosted at `https://d
`<- <token>`
#####Add new nodes to a cluster
`-> POST https://discovery-stage.hub.docker.com/v1/clusters/<token> Request body: "<ip>:<port1>"`
`-> POST https://discovery-stage.hub.docker.com/v1/clusters/<token>?ttl=<ttl> Request body: "<ip>:<port1>"`
`<- OK`
`-> POST https://discovery-stage.hub.docker.com/v1/clusters/<token> Request body: "<ip>:<port2>")`
`-> POST https://discovery-stage.hub.docker.com/v1/clusters/<token>?ttl=<ttl> Request body: "<ip>:<port2>")`
`<- OK`

View File

@ -119,8 +119,8 @@ func (s *Discovery) Watch(stopCh <-chan struct{}) (<-chan discovery.Entries, <-c
func (s *Discovery) Register(addr string) error {
buf := strings.NewReader(addr)
resp, err := http.Post(fmt.Sprintf("%s/%s/%s", s.url,
"clusters", s.token), "application/json", buf)
resp, err := http.Post(fmt.Sprintf("%s/%s/%s?ttl=%d", s.url,
"clusters", s.token, uint64(s.ttl.Seconds())), "application/json", buf)
if err != nil {
return err