use of de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion in project spring-boot by spring-projects.
the class EmbeddedMongoAutoConfiguration method embeddedMongoConfiguration.
@Bean
@ConditionalOnMissingBean
public IMongodConfig embeddedMongoConfiguration() throws IOException {
IFeatureAwareVersion featureAwareVersion = new ToStringFriendlyFeatureAwareVersion(this.embeddedProperties.getVersion(), this.embeddedProperties.getFeatures());
MongodConfigBuilder builder = new MongodConfigBuilder().version(featureAwareVersion);
if (this.embeddedProperties.getStorage() != null) {
builder.replication(new Storage(this.embeddedProperties.getStorage().getDatabaseDir(), this.embeddedProperties.getStorage().getReplSetName(), this.embeddedProperties.getStorage().getOplogSize() != null ? this.embeddedProperties.getStorage().getOplogSize() : 0));
}
Integer configuredPort = this.properties.getPort();
if (configuredPort != null && configuredPort > 0) {
builder.net(new Net(getHost().getHostAddress(), configuredPort, Network.localhostIsIPv6()));
} else {
builder.net(new Net(getHost().getHostAddress(), Network.getFreeServerPort(getHost()), Network.localhostIsIPv6()));
}
return builder.build();
}
Aggregations