From e7c8419b58c30e9c43b7e017d8b6078dc32685ca Mon Sep 17 00:00:00 2001 From: Nikolay Stankov <27363885+nstankov-bg@users.noreply.github.com> Date: Wed, 4 Oct 2023 13:20:34 -0400 Subject: [PATCH 1/2] Update main.go --- cmd/sql-proxy-client/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/sql-proxy-client/main.go b/cmd/sql-proxy-client/main.go index 989fbda..a3783a2 100644 --- a/cmd/sql-proxy-client/main.go +++ b/cmd/sql-proxy-client/main.go @@ -41,7 +41,7 @@ func main() { } func realMain() error { - host := flag.String("host", "127.0.0.1", "Local host to bind and listen for connections") + host := flag.String("host", os.Getenv("PLANETSCALE_LISTENING_HOST"), "Local host to bind and listen for connections") port := flag.String("port", "3306", "Local port to bind and listen for connections") remoteHost := flag.String("remote-host", "", "MySQL remote host") From 6552fb7daa1b8de2a91379336251c9c78d57482d Mon Sep 17 00:00:00 2001 From: Nikolay Stankov <27363885+nstankov-bg@users.noreply.github.com> Date: Wed, 4 Oct 2023 13:23:12 -0400 Subject: [PATCH 2/2] Update main.go --- cmd/sql-proxy-client/main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/sql-proxy-client/main.go b/cmd/sql-proxy-client/main.go index a3783a2..fe7a320 100644 --- a/cmd/sql-proxy-client/main.go +++ b/cmd/sql-proxy-client/main.go @@ -41,7 +41,13 @@ func main() { } func realMain() error { - host := flag.String("host", os.Getenv("PLANETSCALE_LISTENING_HOST"), "Local host to bind and listen for connections") + host := flag.String("host", func() string { + if h := os.Getenv("PLANETSCALE_LISTENING_HOST"); h != "" { + return h + } + return "127.0.0.1" + }(), "Local host to bind and listen for connections") + port := flag.String("port", "3306", "Local port to bind and listen for connections") remoteHost := flag.String("remote-host", "", "MySQL remote host")