File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,16 @@ relay serve --port 8080 --ttl 30s --strategy fifo
166166The API can be consumed by the vendor's application to claim and release a
167167license on behalf of a node.
168168
169+ #### Health Check
170+
171+ The Relay server's health can be tested with the following endpoint:
172+
173+ ``` bash
174+ curl -v -X GET " http://localhost:6349/v1/health"
175+ ```
176+
177+ Returns a ` 200 OK ` status code.
178+
169179#### Claim license
170180
171181Nodes can claim a license by sending a ` PUT ` request to the
Original file line number Diff line number Diff line change @@ -2,10 +2,11 @@ package server
22
33import (
44 "encoding/json"
5- "github.com/gorilla/mux"
6- "github.com/keygen-sh/keygen-relay/internal/licenses"
75 "log/slog"
86 "net/http"
7+
8+ "github.com/gorilla/mux"
9+ "github.com/keygen-sh/keygen-relay/internal/licenses"
910)
1011
1112type RequestBodyPayload struct {
@@ -33,10 +34,15 @@ func NewHandler(m licenses.Manager) Handler {
3334}
3435
3536func (h * handler ) RegisterRoutes (r * mux.Router ) {
37+ r .HandleFunc ("/v1/health" , h .HealthCheck ).Methods ("GET" )
3638 r .HandleFunc ("/v1/nodes/{fingerprint}" , h .ClaimLicense ).Methods ("PUT" )
3739 r .HandleFunc ("/v1/nodes/{fingerprint}" , h .ReleaseLicense ).Methods ("DELETE" )
3840}
3941
42+ func (h * handler ) HealthCheck (w http.ResponseWriter , r * http.Request ) {
43+ w .WriteHeader (http .StatusOK )
44+ }
45+
4046func (h * handler ) ClaimLicense (w http.ResponseWriter , r * http.Request ) {
4147 fingerprint := mux .Vars (r )["fingerprint" ]
4248
You can’t perform that action at this time.
0 commit comments