summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-07-17 01:23:22 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-07-17 01:23:22 (GMT)
commit8e8ccdf43c1cb10b726324496b7fa39b1801d24c (patch)
treeba2f26fd1a4b094bb845259130b19c11d3b8d76d /src
parentdd50bf614cc9282ff1c3a2fd408e902912c00ab6 (diff)
added flag for listen address
Diffstat (limited to 'src')
-rw-r--r--src/helsinki.at/rhrdtime/rhrdtime.go11
1 files changed, 6 insertions, 5 deletions
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)
}