Skip to content

Commit 08484f1

Browse files
Add /v1/keeper/system/health and /v1/keeper/system/ready endpoint.
1 parent 56e7768 commit 08484f1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/main/kotlin/org/exploit/keeper/controller/keeper/SystemController.kt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ package org.exploit.keeper.controller.keeper
33
import jakarta.validation.constraints.NotNull
44
import jakarta.ws.rs.*
55
import jakarta.ws.rs.container.ContainerRequestContext
6+
import jakarta.ws.rs.core.Response
67
import org.exploit.keeper.constant.Permission
8+
import org.exploit.keeper.constant.StoreState
79
import org.exploit.keeper.model.request.KeeperInitData
810
import org.exploit.keeper.model.request.Unseal
911
import org.exploit.keeper.model.seal.StatusResponse
@@ -34,6 +36,23 @@ class SystemController(
3436
return keeper.status()
3537
}
3638

39+
@GET
40+
@Path("/health")
41+
fun health(): Response {
42+
return Response.noContent().build()
43+
}
44+
45+
@GET
46+
@Path("/ready")
47+
fun ready(): Response {
48+
val status = keeper.status().state
49+
50+
return if (status == StoreState.UNSEALED)
51+
Response.noContent().build()
52+
else
53+
Response.status(503).build()
54+
}
55+
3756
@PUT
3857
@Path("/unseal")
3958
fun unseal(@NotNull req: Unseal): Progress {

0 commit comments

Comments
 (0)