From 8e8ccdf43c1cb10b726324496b7fa39b1801d24c Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 17 Jul 2015 03:23:22 +0200 Subject: added flag for listen address diff --git a/src/helsinki.at/rhrdtime/rhrdtime.go b/src/helsinki.at/rhrdtime/rhrdtime.go index a5b47f5..692882b 100644 --- a/src/helsinki.at/rhrdtime/rhrdtime.go +++ b/src/helsinki.at/rhrdtime/rhrdtime.go @@ -108,18 +108,19 @@ func goTalkWithClient(w http.ResponseWriter, r *http.Request, ps *pubsub.PubSub) } } -func RunMartini(ps *pubsub.PubSub) { +func RunMartini(ps *pubsub.PubSub, addr string) { m := martini.Classic() m.Get("/time", func(w http.ResponseWriter, r *http.Request) { goTalkWithClient(w, r, ps) }) - m.Run() + m.RunOnAddr(addr) } func main() { - interval_s := flag.String("interval", "15s", "the interval between updates, default: 15s") - help := flag.Bool("help", false, "show usage") + interval_s := flag.String("interval", "15s", "the interval between updates, default: '15s'") + addr_s := flag.String("addr", ":3000", "addr:port to listen on, default: ':3000'") + help := flag.Bool("help", false, "show usage") flag.Parse() if *help { @@ -142,5 +143,5 @@ func main() { } }() - RunMartini(ps) + RunMartini(ps, *addr_s) } -- cgit v0.10.2