1234567891011121314151617181920212223242526272829303132 |
- package main
- import (
- "fmt"
- "net/http"
- "os"
- "github.com/namsral/flag"
- "git.lattuga.net/boyska/feedpanel/panelui"
- "github.com/urfave/negroni"
- )
- func main() {
- fs := flag.NewFlagSetWithEnvPrefix(os.Args[0], "PANEL", 0)
- allowedName := fs.String("allowed-name", "", "Name allowed to forward auth")
- addr := fs.String("listen-addr", ":8000", "Address to listen on")
- fs.Parse(os.Args[1:])
- 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())
- fmt.Println("Listening on", *addr)
- http.ListenAndServe(*addr, n)
- }
|