diff --git a/tools/api.go b/tools/api.go index 7f0fb9a..71cf88c 100644 --- a/tools/api.go +++ b/tools/api.go @@ -80,11 +80,11 @@ func (a *API) CheckRemotePeer(url string) (State, map[string]int) { return ToState(resp.Data.State), new } -func (a *API) CheckRemoteAPIs(urls []string) (State, map[string]int, error) { +func (a *API) CheckRemoteAPIs(urls map[string]string) (State, map[string]int, error) { // Check if the database is up new := map[string]int{} caller := NewHTTPCaller(map[string]map[METHOD]string{}) - for _, url := range urls { + for appName, url := range urls { var resp APIStatusResponse b, err := caller.CallGet(url, "/version/status") if err != nil { @@ -94,9 +94,7 @@ func (a *API) CheckRemoteAPIs(urls []string) (State, map[string]int, error) { if resp.Data == nil { return DEAD, new, errors.New(url + " -> is DEAD") } - for k, v := range resp.Data.Services { - new[k] = ToState(v).EnumIndex() - } + new[appName] = ToState(resp.Data.State).EnumIndex() if resp.Data.Code != 0 { return REDUCED_SERVICE, new, errors.New(url + " -> " + resp.Error) }