summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhrdtime/rhrdtime.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/helsinki.at/rhrdtime/rhrdtime.go')
-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)
}