From e2b4c3882762406fd3da16f5865cfc3e36e048b5 Mon Sep 17 00:00:00 2001 From: Niall Sheridan Date: Wed, 1 Aug 2018 00:37:11 +0100 Subject: Migrate from esc to packr for static files --- server/web.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'server/web.go') diff --git a/server/web.go b/server/web.go index 08162d5..a32dd40 100644 --- a/server/web.go +++ b/server/web.go @@ -14,6 +14,8 @@ import ( "strconv" "strings" + "github.com/gobuffalo/packr" + "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus/promhttp" @@ -26,7 +28,6 @@ import ( "github.com/nsheridan/cashier/lib" "github.com/nsheridan/cashier/server/auth" "github.com/nsheridan/cashier/server/config" - "github.com/nsheridan/cashier/server/static" "github.com/nsheridan/cashier/server/templates" ) @@ -309,7 +310,8 @@ func runHTTPServer(conf *config.Server, l net.Listener) { r.Methods("GET").Path("/admin/certs.json").Handler(appHandler{ctx, listCertsJSONHandler}) r.Methods("GET").Path("/metrics").Handler(promhttp.Handler()) r.Methods("GET").Path("/healthcheck").HandlerFunc(healthcheck) - r.PathPrefix("/").Handler(http.FileServer(static.FS(false))) + box := packr.NewBox("static") + r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(box))) h := handlers.LoggingHandler(logfile, r) s := &http.Server{ Handler: h, -- cgit v1.2.3