Skip to content

Commit

Permalink
Replace R2DBC Host by docker host ip address (#7431)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddumelendez authored Aug 21, 2023
1 parent 06b9155 commit 6e81732
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import io.r2dbc.spi.ConnectionFactoryMetadata;
import io.r2dbc.spi.ConnectionFactoryOptions;
import io.r2dbc.spi.Option;
import org.testcontainers.DockerClientFactory;

import javax.annotation.Nullable;

Expand All @@ -21,7 +22,7 @@ public interface R2DBCDatabaseContainerProvider {
default ConnectionFactoryMetadata getMetadata(ConnectionFactoryOptions options) {
ConnectionFactoryOptions.Builder builder = options.mutate();
if (!options.hasOption(ConnectionFactoryOptions.HOST)) {
builder.option(ConnectionFactoryOptions.HOST, "localhost");
builder.option(ConnectionFactoryOptions.HOST, DockerClientFactory.instance().dockerHostIpAddress());
}
if (!options.hasOption(ConnectionFactoryOptions.PORT)) {
builder.option(ConnectionFactoryOptions.PORT, 65535);
Expand Down

0 comments on commit 6e81732

Please sign in to comment.