From ccee67900a97c2b0e5cd9bc8404374a1b47cf29a Mon Sep 17 00:00:00 2001 From: Antoine Augusti Date: Wed, 16 Dec 2015 13:48:00 +0100 Subject: [PATCH 1/2] Export route variables to allow to override endpoints --- service.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/service.go b/service.go index 8d38300..11531b8 100644 --- a/service.go +++ b/service.go @@ -17,11 +17,14 @@ import ( "github.com/cloudflare/service/render" ) +// VersionRoute is the path to the version information endpoint +var VersionRoute string = `/_version` + +// HeartbeatRoute is the path to the heartbeat endpoint +var HeartbeatRoute string = `/_heartbeat` + const ( root string = `/` - - // VersionRoute is the path to the version information endpoint - VersionRoute string = `/_version` ) // EndPoint describes an endpoint that exists on this web service @@ -55,7 +58,7 @@ func NewWebService() WebService { ws := WebService{} // Heartbeat controller (echoes the default version info) - heartbeatController := NewWebController("/_heartbeat") + heartbeatController := NewWebController(HeartbeatRoute) heartbeatController.AddMethodHandler(Get, func(w http.ResponseWriter, r *http.Request) { v := Version{} From bc8a5d6911d3a2c9d8807e02abace7860fc6faf2 Mon Sep 17 00:00:00 2001 From: Antoine Augusti Date: Wed, 16 Dec 2015 13:48:19 +0100 Subject: [PATCH 2/2] Fix typo in README for the new heartbeat endpoint --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e70db19..57263f3 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ Access `http://localhost:8080/` for a list of the endpoints available and their ## Heartbeat and Versioning -To enable `/heartbeat` to echo the git hash of the current build and the timestamp of the current build you will need to use a Makefile to build your executable. You will need to adjust your main.go to support this: +To enable `/_heartbeat` to echo the git hash of the current build and the timestamp of the current build you will need to use a Makefile to build your executable. You will need to adjust your main.go to support this: Your `main.go`: