mirror of
https://github.com/davidallendj/opaal.git
synced 2025-12-20 03:27:02 -07:00
Added healthcheck with /status endpoint
This commit is contained in:
parent
34a0fdb66b
commit
ce2d90bc6a
1 changed files with 12 additions and 0 deletions
|
|
@ -56,6 +56,18 @@ func (s *Server) Start(buttons string, provider *oidc.IdentityProvider, client *
|
|||
target = r.Header.Get("target")
|
||||
http.Redirect(w, r, "/login", http.StatusSeeOther)
|
||||
})
|
||||
r.HandleFunc("/status", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
data := map[string]any{
|
||||
"code": 200,
|
||||
"message": "OPAAL is healthy",
|
||||
}
|
||||
err := json.NewEncoder(w).Encode(data)
|
||||
if err != nil {
|
||||
fmt.Printf("failed to encode JSON: %v\n", err)
|
||||
return
|
||||
}
|
||||
})
|
||||
r.HandleFunc("/login", func(w http.ResponseWriter, r *http.Request) {
|
||||
// add target if query exists
|
||||
if r != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue