Merge pull request #406 from sosedoff/fix-startup-error-with-db-url
Fix startup error when DATABASE_URL is set
This commit is contained in:
commit
8dab66567d
@ -65,7 +65,6 @@ func initClient() {
|
|||||||
} else {
|
} else {
|
||||||
cl, err = client.New()
|
cl, err = client.New()
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exitWithMessage(err.Error())
|
exitWithMessage(err.Error())
|
||||||
}
|
}
|
||||||
@ -75,12 +74,11 @@ func initClient() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("Connecting to server...")
|
fmt.Println("Connecting to server...")
|
||||||
err = cl.Test()
|
if err := cl.Test(); err != nil {
|
||||||
if err != nil {
|
|
||||||
msg := err.Error()
|
msg := err.Error()
|
||||||
|
|
||||||
// Check if we're trying to connect to the default database.
|
// 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 database does not exist, allow user to connect from the UI.
|
||||||
if strings.Contains(msg, "database") && strings.Contains(msg, "does not exist") {
|
if strings.Contains(msg, "database") && strings.Contains(msg, "does not exist") {
|
||||||
fmt.Println("Error:", msg)
|
fmt.Println("Error:", msg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user