feat: override PG host Docker-advertised address when set (#732)
This commit is contained in:
1 parent
547ae7c802
commit
bfa3edbbac
2 files changed
+9
-4
No files matched your search
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user