Skip to content

Commit

Permalink
Merge pull request #4 from AntoineAugusti/allow-to-override-version-h…
Browse files Browse the repository at this point in the history
…eartbeat-routes

Allow to override version and heartbeat routes
  • Loading branch information
David Kitchen committed Dec 16, 2015
2 parents be5f6ff + bc8a5d6 commit 60a913f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:

Expand Down
11 changes: 7 additions & 4 deletions service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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{}
Expand Down

0 comments on commit 60a913f

Please sign in to comment.