Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.springframework.boot.docker.compose.core.RunningService;
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionDetailsFactory;
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionSource;
import org.springframework.boot.ssl.SslBundle;

/**
* {@link DockerComposeConnectionDetailsFactory} to create
Expand Down Expand Up @@ -63,9 +64,12 @@ static class RabbitDockerComposeConnectionDetails extends DockerComposeConnectio

private final List<Address> addresses;

private final @Nullable SslBundle sslBundle;

protected RabbitDockerComposeConnectionDetails(RunningService service) {
super(service);
this.environment = new RabbitEnvironment(service.env());
this.sslBundle = getSslBundle(service);
this.addresses = List.of(new Address(service.host(), service.ports().get(RABBITMQ_PORT)));
}

Expand All @@ -79,6 +83,11 @@ protected RabbitDockerComposeConnectionDetails(RunningService service) {
return this.environment.getPassword();
}

@Override
public @Nullable SslBundle getSslBundle() {
return this.sslBundle;
}

@Override
public String getVirtualHost() {
return "/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@

import java.util.List;

import org.jspecify.annotations.Nullable;

import org.springframework.boot.cassandra.autoconfigure.CassandraConnectionDetails;
import org.springframework.boot.docker.compose.core.RunningService;
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionDetailsFactory;
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionSource;
import org.springframework.boot.ssl.SslBundle;

/**
* {@link DockerComposeConnectionDetailsFactory} to create
Expand Down Expand Up @@ -54,11 +57,19 @@ static class CassandraDockerComposeConnectionDetails extends DockerComposeConnec

private final String datacenter;

private final @Nullable SslBundle sslBundle;

CassandraDockerComposeConnectionDetails(RunningService service) {
super(service);
CassandraEnvironment cassandraEnvironment = new CassandraEnvironment(service.env());
this.contactPoints = List.of(new Node(service.host(), service.ports().get(CASSANDRA_PORT)));
this.datacenter = cassandraEnvironment.getDatacenter();
this.sslBundle = getSslBundle(service);
}

@Override
public @Nullable SslBundle getSslBundle() {
return this.sslBundle;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionSource;
import org.springframework.boot.elasticsearch.autoconfigure.ElasticsearchConnectionDetails;
import org.springframework.boot.elasticsearch.autoconfigure.ElasticsearchConnectionDetails.Node.Protocol;
import org.springframework.boot.ssl.SslBundle;

/**
* {@link DockerComposeConnectionDetailsFactory} to create
Expand Down Expand Up @@ -60,13 +61,22 @@ static class ElasticsearchDockerComposeConnectionDetails extends DockerComposeCo

private final List<Node> nodes;

private final @Nullable SslBundle sslBundle;

ElasticsearchDockerComposeConnectionDetails(RunningService service) {
super(service);
this.environment = new ElasticsearchEnvironment(service.env());
this.nodes = List.of(new Node(service.host(), service.ports().get(ELASTICSEARCH_PORT), Protocol.HTTP,
this.sslBundle = getSslBundle(service);
Protocol protocol = (this.sslBundle != null) ? Protocol.HTTPS : Protocol.HTTP;
this.nodes = List.of(new Node(service.host(), service.ports().get(ELASTICSEARCH_PORT), protocol,
getUsername(), getPassword()));
}

@Override
public @Nullable SslBundle getSslBundle() {
return this.sslBundle;
}

@Override
public String getUsername() {
return "elastic";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
package org.springframework.boot.mongodb.docker.compose;

import com.mongodb.ConnectionString;
import org.jspecify.annotations.Nullable;

import org.springframework.boot.docker.compose.core.RunningService;
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionDetailsFactory;
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionSource;
import org.springframework.boot.mongodb.autoconfigure.MongoConnectionDetails;
import org.springframework.boot.ssl.SslBundle;

/**
* {@link DockerComposeConnectionDetailsFactory} to create {@link MongoConnectionDetails}
Expand Down Expand Up @@ -54,8 +56,11 @@ static class MongoDockerComposeConnectionDetails extends DockerComposeConnection

private final ConnectionString connectionString;

private final @Nullable SslBundle sslBundle;

MongoDockerComposeConnectionDetails(RunningService service) {
super(service);
this.sslBundle = getSslBundle(service);
this.connectionString = buildConnectionString(service);

}
Expand All @@ -80,6 +85,11 @@ private ConnectionString buildConnectionString(RunningService service) {
return new ConnectionString(builder.toString());
}

@Override
public @Nullable SslBundle getSslBundle() {
return this.sslBundle;
}

@Override
public ConnectionString getConnectionString() {
return this.connectionString;
Expand Down