|
@@ -1,6 +1,7 @@
|
|
|
package main
|
|
|
|
|
|
import (
|
|
|
+ "flag"
|
|
|
"fmt"
|
|
|
"net/http"
|
|
|
|
|
@@ -9,10 +10,20 @@ import (
|
|
|
)
|
|
|
|
|
|
func main() {
|
|
|
- ha := panelui.HeaderAuth{AllowedNames: []string{"feedati-fe"}, RequireUser: true}
|
|
|
+ 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}
|
|
|
n := negroni.New(negroni.NewRecovery(), negroni.NewLogger(), ha)
|
|
|
n.UseHandler(panelui.GetMux())
|
|
|
- addr := ":8000"
|
|
|
- fmt.Println("Listening on", addr)
|
|
|
- http.ListenAndServe(addr, n)
|
|
|
+ fmt.Println("Listening on", *addr)
|
|
|
+ http.ListenAndServe(*addr, n)
|
|
|
}
|