Make basepath configureable
/chronograf was hard-coded for developing this feature. This adds a --basepath flag that lets users configure what the basepath will actually bepull/814/head
parent
9d2e9111ef
commit
e6a4635266
|
@ -54,7 +54,7 @@ func Assets(opts AssetsOpts) http.Handler {
|
|||
Info("Serving assets")
|
||||
}
|
||||
up := URLPrefixer{
|
||||
Prefix: "/chronograf",
|
||||
Prefix: basepath,
|
||||
Next: assets.Handler(),
|
||||
Attrs: [][]byte{
|
||||
[]byte(`src="`),
|
||||
|
|
|
@ -19,7 +19,10 @@ import (
|
|||
"github.com/tylerb/graceful"
|
||||
)
|
||||
|
||||
var startTime time.Time
|
||||
var (
|
||||
startTime time.Time
|
||||
basepath string
|
||||
)
|
||||
|
||||
func init() {
|
||||
startTime = time.Now().UTC()
|
||||
|
@ -49,6 +52,7 @@ type Server struct {
|
|||
ShowVersion bool `short:"v" long:"version" description:"Show Chronograf version info"`
|
||||
BuildInfo BuildInfo
|
||||
Listener net.Listener
|
||||
Basepath string `long:"basepath" description:"A URL path prefix under which all chronograf routes will be mounted" json:"basePath"`
|
||||
handler http.Handler
|
||||
}
|
||||
|
||||
|
@ -66,6 +70,7 @@ func (s *Server) useAuth() bool {
|
|||
func (s *Server) Serve() error {
|
||||
logger := clog.New(clog.ParseLevel(s.LogLevel))
|
||||
service := openService(s.BoltPath, s.CannedPath, logger, s.useAuth())
|
||||
basepath = s.Basepath
|
||||
s.handler = NewMux(MuxOpts{
|
||||
Develop: s.Develop,
|
||||
TokenSecret: s.TokenSecret,
|
||||
|
|
Loading…
Reference in New Issue