diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2018-08-01 00:37:11 +0100 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2018-08-01 00:37:11 +0100 |
commit | e2b4c3882762406fd3da16f5865cfc3e36e048b5 (patch) | |
tree | 4554004f44fe69a759d37191b8a6236ec0f2c90e /server/web.go | |
parent | 925bc7eb676e25341e30d64da4d12c0e93102cdf (diff) |
Migrate from esc to packr for static files
Diffstat (limited to 'server/web.go')
-rw-r--r-- | server/web.go | 6 |
1 files changed, 4 insertions, 2 deletions
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, |