Skip to content

Commit

Permalink
Added config for base path for web UI
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianOsuna committed Sep 25, 2018
1 parent 63609e8 commit 144f5bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/config/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,7 @@ var Config = struct {

// "HS256" and "RS256" supported
JWTAuthSigningMethod string `env:"FLAGR_JWT_AUTH_SIGNING_METHOD" envDefault:"HS256"`

// WebPrefix - base path for web
WebPrefix string `env:"FLAGR_WEB_PREFIX" envDefault:""`
}{}
6 changes: 5 additions & 1 deletion pkg/config/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ func SetupGlobalMiddleware(handler http.Handler) http.Handler {
n.Use(negronilogrus.NewMiddlewareFromLogger(logrus.StandardLogger(), "flagr"))
}

n.Use(negroni.NewStatic(http.Dir("./browser/flagr-ui/dist/")))
n.Use(&negroni.Static{
Dir: http.Dir("./browser/flagr-ui/dist/"),
Prefix: Config.WebPrefix,
IndexFile: "index.html",
})

if Config.PProfEnabled {
n.UseHandler(pprof.New()(handler))
Expand Down

0 comments on commit 144f5bf

Please sign in to comment.