mirror of
https://github.com/distribution/distribution.git
synced 2025-09-15 22:59:24 +00:00
cleanup: move init funcs to the top of the source
We make sure they're not hiding at the bottom or in the middle which makes debugging an utter nightmare! Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
This commit is contained in:
@@ -9,6 +9,13 @@ import (
|
||||
|
||||
var updater = health.NewStatusUpdater()
|
||||
|
||||
// init sets up the two endpoints to bring the service up and down
|
||||
func init() {
|
||||
health.Register("manual_http_status", updater)
|
||||
http.HandleFunc("/debug/health/down", DownHandler)
|
||||
http.HandleFunc("/debug/health/up", UpHandler)
|
||||
}
|
||||
|
||||
// DownHandler registers a manual_http_status that always returns an Error
|
||||
func DownHandler(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == http.MethodPost {
|
||||
@@ -26,10 +33,3 @@ func UpHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
}
|
||||
}
|
||||
|
||||
// init sets up the two endpoints to bring the service up and down
|
||||
func init() {
|
||||
health.Register("manual_http_status", updater)
|
||||
http.HandleFunc("/debug/health/down", DownHandler)
|
||||
http.HandleFunc("/debug/health/up", UpHandler)
|
||||
}
|
||||
|
Reference in New Issue
Block a user