Skip to content

Commit

Permalink
Feat: healthz endpoint for health checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ivard committed Nov 22, 2023
1 parent 7b7fb4d commit e3d2fbb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Support for Redis in Sentinel mode
- Redis support for `irma keyshare server` and `irma keyshare myirmaserver`
- `/healthz` endpoint for `irma server`, `irma keyshare server` and `irma keyshare myirmaserver`

### Changed
- Using optimistic locking in the `irma server` instead of pessimistic locking
Expand Down
4 changes: 4 additions & 0 deletions server/keyshare/keyshareserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ func (s *Server) Handler() http.Handler {

s.routeHandler(router)

router.Get("/healthz", func(w http.ResponseWriter, r *http.Request) {
server.WriteString(w, "OK")
})

router.Route("/api/v1", func(r chi.Router) {
s.routeHandler(r)
})
Expand Down
4 changes: 4 additions & 0 deletions server/keyshare/myirmaserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ func (s *Server) Handler() http.Handler {
opts := server.LogOptions{Response: true, Headers: true, From: false, EncodeBinary: false}
router.Use(server.LogMiddleware("keyshare-myirma", opts))

router.Get("/healthz", func(w http.ResponseWriter, r *http.Request) {
server.WriteString(w, "OK")
})

// Login/logout
router.Post("/login/irma", s.handleIrmaLogin)
router.Post("/login/email", s.handleEmailLogin)
Expand Down
4 changes: 4 additions & 0 deletions server/requestorserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ func (s *Server) Handler() http.Handler {
r.Use(cors.New(corsOptions).Handler)
r.Use(server.LogMiddleware("requestor", log))

router.Get("/healthz", func(w http.ResponseWriter, r *http.Request) {
server.WriteString(w, "OK")
})

// Server routes
r.Route("/session", func(r chi.Router) {
r.Post("/", s.handleCreateSession)
Expand Down

0 comments on commit e3d2fbb

Please sign in to comment.