feat: override PG host Docker-advertised address when set (#732)

This commit is contained in:
Jeff Malnick authored and GitHub committed 2020-10-20 21:28:57 -04:00
1 parent 547ae7c802
commit bfa3edbbac
2 files changed
+9 -4

No files matched your search

+3 -2
View File
@@ -29,6 +29,9 @@ func startDbInDockerSupported(dialect string) (cleanup func() error, retURL, con
case "postgres":
resource, err = pool.Run("postgres", "12", []string{"POSTGRES_PASSWORD=password", "POSTGRES_DB=boundary"})
url = "postgres://postgres:password@localhost:%s?sslmode=disable"
if err == nil {
url = fmt.Sprintf("postgres://postgres:password@%s?sslmode=disable", resource.GetHostPort("5432/tcp"))
}
default:
panic(fmt.Sprintf("unknown dialect %q", dialect))
}
@@ -40,8 +43,6 @@ func startDbInDockerSupported(dialect string) (cleanup func() error, retURL, con
return cleanupDockerResource(pool, resource)
}
url = fmt.Sprintf(url, resource.GetPort("5432/tcp"))
if err := pool.Retry(func() error {
db, err := sql.Open(dialect, url)
if err != nil {