diff options
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)))) |