forked from influxdata/chronograf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv.go
31 lines (26 loc) · 870 Bytes
/
env.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package server
import (
"net/http"
"github.com/influxdata/chronograf"
)
type envResponse struct {
Links selfLinks `json:"links"`
TelegrafSystemInterval string `json:"telegrafSystemInterval"`
HostPageDisabled bool `json:"hostPageDisabled"`
CustomAutoRefresh string `json:"customAutoRefresh,omitempty"`
}
func newEnvResponse(env chronograf.Environment) *envResponse {
return &envResponse{
Links: selfLinks{
Self: "/chronograf/v1/env",
},
TelegrafSystemInterval: env.TelegrafSystemInterval.String(),
HostPageDisabled: env.HostPageDisabled,
CustomAutoRefresh: env.CustomAutoRefresh,
}
}
// Environment retrieves the global application configuration
func (s *Service) Environment(w http.ResponseWriter, r *http.Request) {
res := newEnvResponse(s.Env)
encodeJSON(w, http.StatusOK, res, s.Logger)
}