From 060858b588883034e1828f314b458704a7eb1f90 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 23 Feb 2019 17:00:20 +0100 Subject: make server url configurable --- cmd/dolmetschctl/dolmetschctl.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cmd/dolmetschctl') diff --git a/cmd/dolmetschctl/dolmetschctl.go b/cmd/dolmetschctl/dolmetschctl.go index 62b176d..26725dc 100644 --- a/cmd/dolmetschctl/dolmetschctl.go +++ b/cmd/dolmetschctl/dolmetschctl.go @@ -155,6 +155,11 @@ func run(ctrl *controller.Controller, ws *websocket.Conn) (error, bool) { func main() { log.Println("hello world.") + base_url := "127.0.0.1:8234" + if len(os.Args) > 1 { + base_url = os.Args[1] + } + c, err := controller.NewController(controller.Config{Dev: "dolmetsch controller"}) if err != nil { log.Printf("Error opening the controller: %v", err) @@ -169,7 +174,7 @@ func main() { log.Printf("controller successfully initialized!") for { - ws, _, err := websocket.DefaultDialer.Dial("ws://127.0.0.1:8234/api/v1/socket", nil) + ws, _, err := websocket.DefaultDialer.Dial("ws://"+base_url+"/api/v1/socket", nil) if err != nil { log.Printf("Error connecting to daemon: %v", err) } else { -- cgit v1.2.3