1
0
Fork 0
forked from boyska/feedpanel
feedpanel/cmd/userpanel/main.go

30 lines
679 B
Go
Raw Normal View History

2018-09-30 11:06:46 +02:00
package main
import (
2018-11-13 14:51:07 +01:00
"flag"
2018-09-30 11:06:46 +02:00
"fmt"
"net/http"
2018-09-30 14:05:25 +02:00
"git.lattuga.net/boyska/feedpanel/panelui"
2018-09-30 14:05:25 +02:00
"github.com/urfave/negroni"
2018-09-30 11:06:46 +02:00
)
func main() {
2018-11-13 14:51:07 +01:00
allowedName := flag.String("allowed-name", "", "Name allowed to forward auth")
addr := flag.String("listen-addr", ":8000", "Address to listen on")
flag.Parse()
var allowedNames []string
if *allowedName != "" {
allowedNames = []string{*allowedName}
} else {
allowedNames = []string{}
}
ha := panelui.HeaderAuth{AllowedNames: allowedNames, RequireUser: true}
2018-09-30 14:05:25 +02:00
n := negroni.New(negroni.NewRecovery(), negroni.NewLogger(), ha)
n.UseHandler(panelui.GetMux())
2018-11-13 14:51:07 +01:00
fmt.Println("Listening on", *addr)
http.ListenAndServe(*addr, n)
2018-09-30 11:06:46 +02:00
}