Beispiel #1
0
// getSetting retrieves a setting from the settings map
func getSetting(c web.C, rw http.ResponseWriter, r *http.Request) {
	log := c.Env[gojiutil.ContextLog].(log15.Logger) // get the context logger
	key := c.URLParams["key"]
	value := settings[key]
	if key == "" || value == "" {
		gojiutil.Errorf(c, rw, 404, `settings key '%s' not found`, key)
		return
	}
	log.Info("settings", "op", "get", "key", key, "value", value)
	gojiutil.WriteString(rw, 200, value)
}
Beispiel #2
0
// Simple health-check handler that returns the version string
func healthCheckHandler(c web.C, rw http.ResponseWriter, r *http.Request) {
	gojiutil.WriteString(rw, 200, VERSION)
}