Skip to content

Commit

Permalink
Healthcheck Route
Browse files Browse the repository at this point in the history
  • Loading branch information
jbragagnolo committed Feb 11, 2023
1 parent 4ca68f7 commit 768e3ae
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ func wrapper(fn func(w http.ResponseWriter, r *http.Request)) http.HandlerFunc {
}
}

func HealthCheckHandler(w http.ResponseWriter, r *http.Request) {
setStrHeader(w, "Content-Type", "text/plain")
io.WriteString(w, "WORKING\n")
}

func proxy(w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
gzipAcceptable := clientAcceptsGzip(r)
Expand Down Expand Up @@ -152,6 +157,7 @@ func main() {
}

r := mux.NewRouter()
r.HandleFunc("/healthcheck{_dummy:/?}", wrapper(HealthCheckHandler)).Methods("GET", "HEAD")
r.HandleFunc("/{bucket:[0-9a-zA-Z-_.]+}/{object:.*}", wrapper(proxy)).Methods("GET", "HEAD")

log.Printf("[service] listening on %s", *bind)
Expand Down

0 comments on commit 768e3ae

Please sign in to comment.