Skip to content

Commit

Permalink
Add SSL to mongo client builder
Browse files Browse the repository at this point in the history
  • Loading branch information
MikkoKauhanen committed Dec 4, 2024
1 parent 06f1b75 commit 2724c1f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import fi.csc.processor.converter.TimeFormatConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.mongo.MongoProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
Expand Down Expand Up @@ -49,6 +48,7 @@ public MongoClient mongoClient(@Qualifier("primaryProperties") MongoProperties m
mongoProperties.getUsername(),
mongoProperties.getDatabase(),
mongoProperties.getPassword()))
.applyToSslSettings(builder -> builder.enabled(true).invalidHostNameAllowed(true))
.applyToClusterSettings(settings -> settings.hosts(singletonList(new ServerAddress(
mongoProperties.getHost(),
mongoProperties.getPort()
Expand Down

0 comments on commit 2724c1f

Please sign in to comment.