Skip to content

Commit 0b48586

Browse files
committed
Allow overriding listen host. Add startup message
1 parent fb33d97 commit 0b48586

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func main() {
1919
return [][]byte{[]byte("Access-Control-Allow-Origin: http://localhost:5000")}
2020
})
2121
defer es.Close()
22+
host := flag.String("host", "", "Listen on")
2223
port := flag.Int("port", 9009, "Listen port for Server")
2324

2425
flag.Parse()
@@ -29,7 +30,8 @@ func main() {
2930
http.Handle("/events", es)
3031
http.Handle("/", http.FileServer(AssetFile()))
3132

32-
err := http.ListenAndServe(fmt.Sprintf(":%d", *port), nil)
33+
log.Printf("Starting webserver at %s:%d\n", *host, *port)
34+
err := http.ListenAndServe(fmt.Sprintf("%s:%d", *host, *port), nil)
3335
if err != nil {
3436
log.Fatalln(err)
3537
}

0 commit comments

Comments
 (0)