Skip to content

Commit

Permalink
Merge pull request #46480 from knz/backport19.1-44113
Browse files Browse the repository at this point in the history
release-19.1: cli: fix `--url` with `sslmode` omitted but other options presents
  • Loading branch information
knz committed Mar 24, 2020
2 parents cfdc5f3 + 887583c commit 3c0200a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/cli/client_url.go
Expand Up @@ -175,7 +175,7 @@ func (u urlParser) Set(v string) error {
cliCtx.extraConnURLOptions = options

switch sslMode := options.Get("sslmode"); sslMode {
case "disable":
case "", "disable":
if err := fl.Set(cliflags.ClientInsecure.Name, "true"); err != nil {
return errors.Wrapf(err, "setting insecure connection based on --url")
}
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/flags_test.go
Expand Up @@ -214,6 +214,7 @@ func TestClientURLFlagEquivalence(t *testing.T) {
{anySQL, []string{"--url=postgresql://a@b:c"}, []string{"--user=a", "--host=b", "--port=c"}, ""},
{anyNonSQL, []string{"--url=postgresql://b:c"}, []string{"--host=b", "--port=c"}, ""},

{anyCmd, []string{"--url=postgresql://foo?application_name=abc"}, []string{"--host=foo", "--insecure"}, ""},
{anyCmd, []string{"--url=postgresql://foo?sslmode=disable"}, []string{"--host=foo", "--insecure"}, ""},
{anySQL, []string{"--url=postgresql://foo?sslmode=require"}, []string{"--host=foo", "--insecure=false"}, ""},
{anyNonSQL, []string{"--url=postgresql://foo?sslmode=require"}, nil, "command .* only supports sslmode=disable or sslmode=verify-full"},
Expand Down

0 comments on commit 3c0200a

Please sign in to comment.