Add X-Chronograf-Version header
parent
1144047477
commit
4bef66aff7
|
@ -12,6 +12,7 @@
|
|||
4. [#706](https://github.com/influxdata/chronograf/issues/706): Alerts on threshold where value is inside of range
|
||||
5. [#707](https://github.com/influxdata/chronograf/issues/707): Alerts on threshold where value is outside of range
|
||||
6. [#766](https://github.com/influxdata/chronograf/pull/766): Add click-to-insert functionality to rule message templates
|
||||
7. [#766](https://github.com/influxdata/chronograf/pull/772): Add X-Chronograf-Version header to all requests
|
||||
|
||||
## v1.1.0-beta5 [2017-01-05]
|
||||
|
||||
|
|
2
Makefile
2
Makefile
|
@ -3,7 +3,7 @@ COMMIT ?= $(shell git rev-parse --short=8 HEAD)
|
|||
|
||||
SOURCES := $(shell find . -name '*.go')
|
||||
|
||||
LDFLAGS=-ldflags "-s -X main.Version=${VERSION} -X main.Commit=${COMMIT}"
|
||||
LDFLAGS=-ldflags "-s -X main.version=${VERSION} -X main.commit=${COMMIT}"
|
||||
BINARY=chronograf
|
||||
|
||||
default: dep build
|
||||
|
|
|
@ -76,6 +76,8 @@ func (s *Server) Serve() error {
|
|||
UseAuth: s.useAuth(),
|
||||
}, service)
|
||||
|
||||
s.handler = Version(s.BuildInfo.Version, s.handler)
|
||||
|
||||
var err error
|
||||
s.Listener, err = net.Listen("tcp", net.JoinHostPort(s.Host, strconv.Itoa(s.Port)))
|
||||
if err != nil {
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Version(version string, h http.Handler) http.Handler {
|
||||
fn := func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Add("X-Chronograf-Version", version)
|
||||
h.ServeHTTP(w, r)
|
||||
}
|
||||
return http.HandlerFunc(fn)
|
||||
}
|
Loading…
Reference in New Issue