From 6e2c7a98c3dcd65a81b5543a382229b13af09744 Mon Sep 17 00:00:00 2001 From: Tom Prince Date: Mon, 23 Mar 2020 15:50:48 -0600 Subject: [PATCH] Rename dockerhub handler in preperation for suppport for other handlers. (#19) Co-authored-by: Jeremiah Orem --- main.go | 16 +++++++++------- .../{handlers.go => dockerhub_handler.go} | 0 2 files changed, 9 insertions(+), 7 deletions(-) rename proxyservice/{handlers.go => dockerhub_handler.go} (100%) diff --git a/main.go b/main.go index 52ad8e4..f639bcd 100644 --- a/main.go +++ b/main.go @@ -54,17 +54,19 @@ func main() { return cli.NewExitError(err.Error(), 1) } - handler := proxyservice.NewDockerHubWebhookHandler( - proxyservice.NewJenkins( - c.String("jenkins-base-url"), - c.String("jenkins-user"), - c.String("jenkins-password"), - ), + jenkins := proxyservice.NewJenkins( + c.String("jenkins-base-url"), + c.String("jenkins-user"), + c.String("jenkins-password"), + ) + + dockerhubHandler := proxyservice.NewDockerHubWebhookHandler( + jenkins, c.StringSlice("valid-namespace")..., ) mux := http.NewServeMux() - mux.Handle("/dockerhub", handler) + mux.Handle("/dockerhub", dockerhubHandler) mux.HandleFunc("/__heartbeat__", func(w http.ResponseWriter, req *http.Request) { w.Write([]byte("OK")) }) diff --git a/proxyservice/handlers.go b/proxyservice/dockerhub_handler.go similarity index 100% rename from proxyservice/handlers.go rename to proxyservice/dockerhub_handler.go