From b238d851592d0d0a120f1c940a538c722e3a674f Mon Sep 17 00:00:00 2001 From: Ying Li Date: Wed, 21 Oct 2015 10:57:55 -0700 Subject: [PATCH] Add the health handler to the main server Signed-off-by: Ying Li --- server/server.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/server.go b/server/server.go index cc8e29ded6..ead036958a 100644 --- a/server/server.go +++ b/server/server.go @@ -7,6 +7,7 @@ import ( "net/http" "github.com/Sirupsen/logrus" + "github.com/docker/distribution/health" "github.com/docker/distribution/registry/auth" "github.com/endophage/gotuf/data" "github.com/endophage/gotuf/signed" @@ -74,6 +75,11 @@ func Run(ctx context.Context, addr, tlsCertFile, tlsKeyFile string, trust signed r.Methods("GET").Path("/v2/{imageName:.*}/_trust/tuf/timestamp.json").Handler(hand(handlers.GetTimestampHandler, "pull")) r.Methods("GET").Path("/v2/{imageName:.*}/_trust/tuf/timestamp.key").Handler(hand(handlers.GetTimestampKeyHandler, "push", "pull")) r.Methods("DELETE").Path("/v2/{imageName:.*}/_trust/tuf/").Handler(hand(handlers.DeleteHandler, "push", "pull")) + r.Methods("GET").Path("/_notary_server/health").Handler(hand( + func(ctx context.Context, w http.ResponseWriter, r *http.Request) error { + health.StatusHandler(w, r) + return nil + })) r.Methods("GET", "POST", "PUT", "HEAD", "DELETE").Path("/{other:.*}").Handler(hand(utils.NotFoundHandler)) svr := http.Server{ Addr: addr,