From ef1ba61ca79e8348d782a3298fcbd97a0bdb7dc5 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Mon, 24 Mar 2014 20:53:46 +0100 Subject: Chatrooms roughly implemented --- main.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index c18959a..b546da4 100644 --- a/main.go +++ b/main.go @@ -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)))) -- cgit v1.2.3-54-g00ecf