]> git.scottworley.com Git - reliable-chat/commitdiff
Allow port to be specified. Default resonably.
authorScott Worley <sworley@chkno.net>
Sat, 28 Jul 2012 18:38:53 +0000 (11:38 -0700)
committerScott Worley <sworley@chkno.net>
Sat, 28 Jul 2012 18:38:53 +0000 (11:38 -0700)
server/server.go

index 7572447610372c8dd45c6c6dc063924df36bcecf..c47bfaa2f63849d89376abeac8709d2648d38b83 100644 (file)
@@ -2,10 +2,14 @@ package main
 
 import "container/list"
 import "encoding/json"
+import "flag"
 import "log"
 import "net/http"
+import "strconv"
 import "time"
 
+var port = flag.Int("port", 21059, "Port to listen on")
+
 type Message struct {
        Time time.Time
        Text string
@@ -110,7 +114,7 @@ func start_server(store Store) {
                store.Add <- &Message{time.Now(), r.FormValue("text")}
        })
 
-       log.Fatal(http.ListenAndServe(":8080", nil))
+       log.Fatal(http.ListenAndServe(":" + strconv.Itoa(*port), nil))
 }
 
 func main() {