feat: persist data in PostgreSQL and add Basic/Bearer sessions in Redis

This commit is contained in:
2026-10-30 01:34:50 +03:00
parent 196e118ede
commit f68710818d
27 changed files with 1229 additions and 214 deletions
+16 -2
View File
@@ -1,11 +1,25 @@
package handler
import "net/http"
import (
"context"
"net/http"
"time"
)
const readyTimeout = time.Second
func (h *Handler) Live(w http.ResponseWriter, _ *http.Request) {
writeJSON(w, http.StatusOK, healthResponse{Status: "ok"})
}
func (h *Handler) Ready(w http.ResponseWriter, _ *http.Request) {
func (h *Handler) Ready(w http.ResponseWriter, r *http.Request) {
ctx, cancel := context.WithTimeout(r.Context(), readyTimeout)
defer cancel()
for _, dep := range h.deps {
if err := dep(ctx); err != nil {
h.fail(w, r, err)
return
}
}
writeJSON(w, http.StatusOK, healthResponse{Status: "ok"})
}