Replace go-bindata with Go embed

Co-authored-by: nrwiersma <nick@wiersma.co.za>
This commit is contained in:
Antoine 2021-09-15 10:36:14 +02:00 committed by GitHub
parent 7ff13c3e3e
commit 70359e5d27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 142 additions and 205 deletions

View file

@ -6,7 +6,6 @@ import (
"reflect"
"strings"
assetfs "github.com/elazarl/go-bindata-assetfs"
"github.com/gorilla/mux"
"github.com/traefik/traefik/v2/pkg/config/dynamic"
"github.com/traefik/traefik/v2/pkg/config/runtime"
@ -48,10 +47,7 @@ type RunTimeRepresentation struct {
// Handler serves the configuration and status of Traefik on API endpoints.
type Handler struct {
dashboard bool
debug bool
staticConfig static.Configuration
dashboardAssets *assetfs.AssetFS
staticConfig static.Configuration
// runtimeConfiguration is the data set used to create all the data representations exposed by the API.
runtimeConfiguration *runtime.Configuration
@ -73,11 +69,8 @@ func New(staticConfig static.Configuration, runtimeConfig *runtime.Configuration
}
return &Handler{
dashboard: staticConfig.API.Dashboard,
dashboardAssets: staticConfig.API.DashboardAssets,
runtimeConfiguration: rConfig,
staticConfig: staticConfig,
debug: staticConfig.API.Debug,
}
}
@ -85,7 +78,7 @@ func New(staticConfig static.Configuration, runtimeConfig *runtime.Configuration
func (h Handler) createRouter() *mux.Router {
router := mux.NewRouter()
if h.debug {
if h.staticConfig.API.Debug {
DebugHandler{}.Append(router)
}
@ -118,10 +111,6 @@ func (h Handler) createRouter() *mux.Router {
version.Handler{}.Append(router)
if h.dashboard {
DashboardHandler{Assets: h.dashboardAssets}.Append(router)
}
return router
}