mirror of
https://github.com/miniflux/v2.git
synced 2025-08-31 18:31:01 +00:00
Improve health check endpoint to test database connection
This commit is contained in:
parent
c2571f9f47
commit
e3c28a6c96
4 changed files with 29 additions and 14 deletions
|
@ -184,6 +184,11 @@ func setupHandler(store *storage.Storage, pool *worker.Pool) *mux.Router {
|
|||
ui.Serve(router, store, pool)
|
||||
|
||||
router.HandleFunc("/healthcheck", func(w http.ResponseWriter, r *http.Request) {
|
||||
if err := store.Ping(); err != nil {
|
||||
http.Error(w, "Database Connection Error", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
w.Write([]byte("OK"))
|
||||
}).Name("healthcheck")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue