summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2014-03-24 20:53:46 +0100
committerKevin Chabowski <kevin@kch42.de>2014-03-24 20:53:46 +0100
commitef1ba61ca79e8348d782a3298fcbd97a0bdb7dc5 (patch)
tree74d2bf499fb116da1a22de1f79256530f5d7b79a /main.go
parent79fed0e58753d50c613d15589b8f687474c2224c (diff)
downloadsimplechat-ef1ba61ca79e8348d782a3298fcbd97a0bdb7dc5.tar.gz
simplechat-ef1ba61ca79e8348d782a3298fcbd97a0bdb7dc5.tar.bz2
simplechat-ef1ba61ca79e8348d782a3298fcbd97a0bdb7dc5.zip
Chatrooms roughly implemented
Diffstat (limited to 'main.go')
-rw-r--r--main.go9
1 files changed, 9 insertions, 0 deletions
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))))