feat(cli): enhance user and hook management with new commands and flags
This commit is contained in:
@@ -102,6 +102,16 @@ func decodeJSON(resp *http.Response, target interface{}) error {
|
||||
return json.NewDecoder(resp.Body).Decode(target)
|
||||
}
|
||||
|
||||
// serverAvailable checks if the server is reachable via the health endpoint.
|
||||
func serverAvailable(client *Client) bool {
|
||||
resp, err := client.client.Get(client.baseURL + "/health")
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
resp.Body.Close()
|
||||
return resp.StatusCode < 500
|
||||
}
|
||||
|
||||
// checkError prints error and exits if error is not nil
|
||||
func checkError(err error) {
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user