Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Setup framework options and initialize the framework
// aboutFilePath = path for the about file for metadata about service.
// Ussually hosted in project for developers / ops to edit.
// Sample at https://github.com/hootsuite/healthchecks/blob/master/test/about.json
aboutFilePath := "conf/about.json"
// versionFilePath = path for the version file for current version of running service.
// Ussually created at build / deploy time.
// Sample at https://github.com/hootsuite/healthchecks/blob/master/test/version.txt
versionFilePath := "conf/version.txt"
// OPTIONAL - Set up any service injected customData for /status/about response.
// Values can be any valid JSON conversion and will override values set in about.json.
customData := make(map[string]interface{})
// Examples:
//
// String value
// customData["a-string"] = "some-value"
//
// Number value
// customData["a-number"] = 123
//
// Boolean value
// customData["a-bool"] = true
//
// Array
// customData["an-array"] = []string{"val1", "val2"}
//
// Custom object
// customObject := make(map[string]interface{})
// customObject["key1"] = 1
// customObject["key2"] = "some-value"
// customData["an-object"] = customObject
// Register all "/status/..." requests to use our health checking framework
http.Handle("/status/", healthchecks.Handler(statusEndpoints, aboutFilePath, versionFilePath, customData))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.