Skip to content

Commit

Permalink
Merge pull request #27 from storageos/feature/DEV-1680-exposed-ports-…
Browse files Browse the repository at this point in the history
…should-be-in-contiguous

Move DP health port to constant and update value
  • Loading branch information
JoeReid authored Oct 25, 2017
2 parents e1440c0 + eba55d6 commit 5e025fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ var (
// DefaultPort is the default API port
DefaultPort = "5705"

// DataplaneHealthPort is the the port used by the dataplane health-check service
DataplaneHealthPort = "5704"

// DefaultHost is the default API host
DefaultHost = "tcp://localhost:" + DefaultPort
)
Expand Down
7 changes: 5 additions & 2 deletions health.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package storageos
import (
"context"
"encoding/json"
"fmt"
"net/http"

"github.com/storageos/go-api/types"
Expand All @@ -16,7 +17,8 @@ var (
// CPHealth returns the health of the control plane server at a given url.
func (c *Client) CPHealth(ctx context.Context, hostname string) (*types.CPHealthStatus, error) {

req, err := http.NewRequest("GET", "http://"+hostname+":5705/v1/"+HealthAPIPrefix, nil)
url := fmt.Sprintf("http://%s:%s/v1/%s", hostname, DefaultPort, HealthAPIPrefix)
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return nil, err
}
Expand All @@ -43,7 +45,8 @@ func (c *Client) CPHealth(ctx context.Context, hostname string) (*types.CPHealth
// DPHealth returns the health of the data plane server at a given url.
func (c *Client) DPHealth(ctx context.Context, hostname string) (*types.DPHealthStatus, error) {

req, err := http.NewRequest("GET", "http://"+hostname+":8001/v1/"+HealthAPIPrefix, nil)
url := fmt.Sprintf("http://%s:%s/v1/%s", hostname, DataplaneHealthPort, HealthAPIPrefix)
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 5e025fb

Please sign in to comment.