From 1d794896ac63c55d1eaf61b9b581cc9c2c5ac46b Mon Sep 17 00:00:00 2001 From: Bernerd Schaefer Date: Thu, 23 May 2013 15:47:00 +0200 Subject: [PATCH] Support user-provided static asset directory [fix #159] --- web/web.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/web.go b/web/web.go index 987d2a6f14..07542d914c 100644 --- a/web/web.go +++ b/web/web.go @@ -31,6 +31,7 @@ import ( var ( listenAddress = flag.String("listenAddress", ":9090", "Address to listen on for web interface.") useLocalAssets = flag.Bool("useLocalAssets", false, "Read assets/templates from file instead of binary.") + userAssetsPath = flag.String("userAssets", "", "Path to static asset directory, available at /user") ) type WebService struct { @@ -65,6 +66,10 @@ func (w WebService) ServeForever() error { exp.Handle("/static/", http.StripPrefix("/static/", new(blob.Handler))) } + if *userAssetsPath != "" { + exp.Handle("/user/", http.StripPrefix("/user/", http.FileServer(http.Dir(*userAssetsPath)))) + } + log.Printf("listening on %s", *listenAddress) return http.ListenAndServe(*listenAddress, exp.DefaultCoarseMux)