Configurable API & Dashboard base path
Co-authored-by: Kevin Pollet <pollet.kevin@gmail.com>
This commit is contained in:
parent
090db6d4b0
commit
0ec12c7aa7
12 changed files with 253 additions and 50 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/traefik/traefik/v3/pkg/api"
|
||||
"github.com/traefik/traefik/v3/pkg/api/dashboard"
|
||||
"github.com/traefik/traefik/v3/pkg/config/runtime"
|
||||
|
@ -44,10 +45,13 @@ func NewManagerFactory(staticConfiguration static.Configuration, routinesPool *s
|
|||
apiRouterBuilder := api.NewBuilder(staticConfiguration)
|
||||
|
||||
if staticConfiguration.API.Dashboard {
|
||||
factory.dashboardHandler = dashboard.Handler{}
|
||||
factory.dashboardHandler = dashboard.Handler{BasePath: staticConfiguration.API.BasePath}
|
||||
factory.api = func(configuration *runtime.Configuration) http.Handler {
|
||||
router := apiRouterBuilder(configuration).(*mux.Router)
|
||||
dashboard.Append(router, nil)
|
||||
if err := dashboard.Append(router, staticConfiguration.API.BasePath, nil); err != nil {
|
||||
log.Error().Err(err).Msg("Error appending dashboard to API router")
|
||||
}
|
||||
|
||||
return router
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue