FIX static files

This commit is contained in:
boyska 2018-11-13 15:09:33 +01:00
parent f17b8179b6
commit bf0fd51252
2 changed files with 8 additions and 5 deletions

View file

@ -1,18 +1,21 @@
package main package main
import ( import (
"flag"
"fmt" "fmt"
"net/http" "net/http"
"os"
"github.com/namsral/flag"
"git.lattuga.net/boyska/feedpanel/panelui" "git.lattuga.net/boyska/feedpanel/panelui"
"github.com/urfave/negroni" "github.com/urfave/negroni"
) )
func main() { func main() {
allowedName := flag.String("allowed-name", "", "Name allowed to forward auth") fs := flag.NewFlagSetWithEnvPrefix(os.Args[0], "PANEL", 0)
addr := flag.String("listen-addr", ":8000", "Address to listen on") allowedName := fs.String("allowed-name", "", "Name allowed to forward auth")
flag.Parse() addr := fs.String("listen-addr", ":8000", "Address to listen on")
fs.Parse(os.Args[1:])
var allowedNames []string var allowedNames []string
if *allowedName != "" { if *allowedName != "" {

View file

@ -24,6 +24,6 @@ func GetMux() *http.ServeMux {
templateExecute(w, r, "home.html", templates, templateExecute(w, r, "home.html", templates,
map[string]interface{}{"User": user}) map[string]interface{}{"User": user})
}) })
mux.Handle("/static", http.FileServer(static.HTTPBox())) mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(static.HTTPBox())))
return mux return mux
} }