From a7959ad0fab9aa9be567c7d89a130e8fa383f6de Mon Sep 17 00:00:00 2001 From: Dan Sosedoff Date: Fri, 25 Jan 2019 10:29:24 -0600 Subject: [PATCH] Fix startup error when DATABASE_URL is set --- pkg/cli/cli.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/cli/cli.go b/pkg/cli/cli.go index a31a14a..d6eecba 100644 --- a/pkg/cli/cli.go +++ b/pkg/cli/cli.go @@ -65,7 +65,6 @@ func initClient() { } else { cl, err = client.New() } - if err != nil { exitWithMessage(err.Error()) } @@ -75,12 +74,11 @@ func initClient() { } fmt.Println("Connecting to server...") - err = cl.Test() - if err != nil { + if err := cl.Test(); err != nil { msg := err.Error() // Check if we're trying to connect to the default database. - if command.Opts.DbName == "" { + if command.Opts.DbName == "" && command.Opts.Url == "" { // If database does not exist, allow user to connect from the UI. if strings.Contains(msg, "database") && strings.Contains(msg, "does not exist") { fmt.Println("Error:", msg)