commit 211c9db761b17f31e630fc90d33fdcf8cc321619
parent f27df5b7a6189a9eb424e7da7f1f5e00555623ce
Author: Jack Mordaunt <jackmordaunt@gmail.com>
Date: Fri, 16 Nov 2018 17:30:38 +1300
[~] Handle address shorthand for `-dev-proxy`.
Expand `host:port` to `http://host:port`.
Expand `:port` to `http://localhost:port`.
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/cmd/desktop/main.go b/cmd/desktop/main.go
@@ -1,6 +1,7 @@
package main
import (
+ "strings"
"context"
"syscall"
"os/signal"
@@ -44,9 +45,16 @@ func init() {
flag.BoolVar(&chrome, "chrome", false, "use chrome to render the UI instead of the native webview")
flag.Parse()
if devServer != "" {
+ original := devServer
+ if devServer[0] == ':' {
+ devServer = fmt.Sprintf("127.0.0.1:%s", devServer[1:])
+ }
+ if !strings.HasPrefix(devServer, "http://") {
+ devServer = fmt.Sprintf("http://%s", devServer)
+ }
t, err := url.Parse(devServer)
if err != nil {
- log.Fatalf("proxy: %s: not a valid URL", devServer)
+ log.Fatalf("proxy: %s: not a valid URL", original)
}
static = &Proxy{Target: t}
} else {