include oc in racine path for remote calling
This commit is contained in:
@@ -91,7 +91,7 @@ func (a *API) CheckRemotePeer(url string) (State, map[string]int) {
|
||||
}
|
||||
|
||||
// CheckRemoteAPIs checks the state of remote APIs from your proper OC
|
||||
func (a *API) CheckRemoteAPIs(urls map[string]string) (State, map[string]string, error) {
|
||||
func (a *API) CheckRemoteAPIs(apis []DataType) (State, map[string]string, error) {
|
||||
// Check if the database is up
|
||||
new := map[string]string{}
|
||||
caller := NewHTTPCaller(map[DataType]map[METHOD]string{}) // Create a new http caller
|
||||
@@ -99,9 +99,9 @@ func (a *API) CheckRemoteAPIs(urls map[string]string) (State, map[string]string,
|
||||
e := ""
|
||||
state := ALIVE
|
||||
reachable := false
|
||||
for appName, url := range urls { // Check the state of each remote API in the list
|
||||
for _, api := range apis { // Check the state of each remote API in the list
|
||||
var resp APIStatusResponse
|
||||
b, err := caller.CallGet(url, "/version/status") // Call the status endpoint of the remote API (standard OC status endpoint)
|
||||
b, err := caller.CallGet(api.API()+":8080", "/oc/version/status") // Call the status endpoint of the remote API (standard OC status endpoint)
|
||||
if err != nil {
|
||||
state = REDUCED_SERVICE // If a remote API is not reachable, return reduced service
|
||||
continue
|
||||
@@ -111,7 +111,7 @@ func (a *API) CheckRemoteAPIs(urls map[string]string) (State, map[string]string,
|
||||
state = REDUCED_SERVICE // If the response is empty, return reduced service
|
||||
continue
|
||||
}
|
||||
new[appName] = resp.Data.State
|
||||
new[api.String()] = resp.Data.State
|
||||
if resp.Data.Code > code {
|
||||
code = resp.Data.Code
|
||||
e += resp.Error
|
||||
|
Reference in New Issue
Block a user