Fix: Directory prefix not stripped

This commit is contained in:
Knut Ahlers 2020-11-23 11:33:34 +01:00
parent 87ba88fc53
commit 1569df222e
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

View file

@ -16,7 +16,7 @@ import (
var ( var (
cfg = struct { cfg = struct {
AssetCheckInterval time.Duration `flag:"asset-check-interval" default:"1m" description:"How often to check asset files for updates"` AssetCheckInterval time.Duration `flag:"asset-check-interval" default:"1m" description:"How often to check asset files for updates"`
AssetDir string `flag:"asset-dir" default:"." description:"Directory containing assets"` AssetDir string `flag:"asset-dir" default:"./public" description:"Directory containing assets"`
BaseURL string `flag:"base-url" default:"" description:"Base URL of this service" validate:"nonzero"` BaseURL string `flag:"base-url" default:"" description:"Base URL of this service" validate:"nonzero"`
ForceSyncInterval time.Duration `flag:"force-sync-interval" default:"1m" description:"How often to force a sync without updates"` ForceSyncInterval time.Duration `flag:"force-sync-interval" default:"1m" description:"How often to force a sync without updates"`
Listen string `flag:"listen" default:":3000" description:"Port/IP to listen on"` Listen string `flag:"listen" default:":3000" description:"Port/IP to listen on"`
@ -65,7 +65,7 @@ func main() {
} }
var ( var (
assetServer = http.FileServer(http.Dir(cfg.AssetDir)) assetServer = http.StripPrefix("/public", http.FileServer(http.Dir(cfg.AssetDir)))
router = mux.NewRouter() router = mux.NewRouter()
) )
registerAPI(router) registerAPI(router)