diff options
author | Kevin Chabowski <kevin@kch42.de> | 2014-03-24 20:53:46 +0100 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2014-03-24 20:53:46 +0100 |
commit | ef1ba61ca79e8348d782a3298fcbd97a0bdb7dc5 (patch) | |
tree | 74d2bf499fb116da1a22de1f79256530f5d7b79a /main.go | |
parent | 79fed0e58753d50c613d15589b8f687474c2224c (diff) | |
download | simplechat-ef1ba61ca79e8348d782a3298fcbd97a0bdb7dc5.tar.gz simplechat-ef1ba61ca79e8348d782a3298fcbd97a0bdb7dc5.tar.bz2 simplechat-ef1ba61ca79e8348d782a3298fcbd97a0bdb7dc5.zip |
Chatrooms roughly implemented
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -3,6 +3,8 @@ package main import ( "flag" "github.com/gorilla/mux" + "log" + "math" "net/http" ) @@ -10,11 +12,18 @@ var ( laddr = flag.String("laddr", ":8080", "Listen on this address") tplpath = flag.String("tplpath", "tpls", "Path to templates") staticpath = flag.String("staticpath", "static", "Path to static page elements") + perroom = flag.Int("perroom", -1, "Maximum amount of users per room (negative for unlimited)") ) func main() { flag.Parse() + if *perroom < 0 { + *perroom = math.MaxInt32 + } else if *perroom == 0 { + log.Fatalln("flag perroom must not be 0") + } + r := mux.NewRouter() r.HandleFunc("/", Home) r.PathPrefix("/static").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir(*staticpath)))) |