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
166
166
The API can be consumed by the vendor's application to claim and release a
167
167
license on behalf of a node.
168
168
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
+
169
179
#### Claim license
170
180
171
181
Nodes 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
2
2
3
3
import (
4
4
"encoding/json"
5
- "github.com/gorilla/mux"
6
- "github.com/keygen-sh/keygen-relay/internal/licenses"
7
5
"log/slog"
8
6
"net/http"
7
+
8
+ "github.com/gorilla/mux"
9
+ "github.com/keygen-sh/keygen-relay/internal/licenses"
9
10
)
10
11
11
12
type RequestBodyPayload struct {
@@ -33,10 +34,15 @@ func NewHandler(m licenses.Manager) Handler {
33
34
}
34
35
35
36
func (h * handler ) RegisterRoutes (r * mux.Router ) {
37
+ r .HandleFunc ("/v1/health" , h .HealthCheck ).Methods ("GET" )
36
38
r .HandleFunc ("/v1/nodes/{fingerprint}" , h .ClaimLicense ).Methods ("PUT" )
37
39
r .HandleFunc ("/v1/nodes/{fingerprint}" , h .ReleaseLicense ).Methods ("DELETE" )
38
40
}
39
41
42
+ func (h * handler ) HealthCheck (w http.ResponseWriter , r * http.Request ) {
43
+ w .WriteHeader (http .StatusOK )
44
+ }
45
+
40
46
func (h * handler ) ClaimLicense (w http.ResponseWriter , r * http.Request ) {
41
47
fingerprint := mux .Vars (r )["fingerprint" ]
42
48
You can’t perform that action at this time.
0 commit comments