diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -2,6 +2,7 @@ package main import ( _ "embed" + "flag" "fmt" "html/template" "log" @@ -171,8 +172,11 @@ func doneHandler(w http.ResponseWriter, r *http.Request) { } } +var port = flag.Int("p", 8080, "the port to use") + func main() { - // Make a new Broker instance + flag.Parse() + broker = &Broker{ make(map[chan string]bool), make(chan (chan string)), @@ -180,7 +184,6 @@ func main() { make(chan string), } - // Start processing events broker.Start() pageTemplate = template.Must(template.New("index").Parse(indexTemplate)) @@ -190,7 +193,7 @@ func main() { http.HandleFunc("/done", doneHandler) http.Handle("/events", broker) - log.Printf("Serving http on %d", 8080) + log.Printf("Serving http on %d\n", *port) err := http.ListenAndServe(fmt.Sprintf(":%d", 8080), nil) log.Panicf("Serving http failed with %s", err) } |
