use of de.flapdoodle.embed.mongo.Command in project flow.service.workflow by boomerang-io.
the class MongoConfig method afterPropertiesSet.
@Override
public void afterPropertiesSet() throws Exception {
String proxyHost = System.getProperty("http.proxyHost");
String proxyPort = System.getProperty("http.proxyPort");
MongodStarter starter = null;
ProcessOutput processOutput = enableMongoLogs ? ProcessOutput.getDefaultInstance("mongo") : ProcessOutput.getDefaultInstanceSilent();
Command command = Command.MongoD;
if (StringUtils.hasText(proxyHost) && StringUtils.hasText(proxyPort)) {
final DownloadConfig downloadConfig = Defaults.downloadConfigFor(command).proxyFactory(new HttpProxyFactory(proxyHost, Integer.parseInt(proxyPort))).build();
RuntimeConfig runtimeConfig = Defaults.runtimeConfigFor(command).processOutput(processOutput).artifactStore(Defaults.extractedArtifactStoreFor(command).withDownloadConfig(downloadConfig)).build();
starter = MongodStarter.getInstance(runtimeConfig);
} else {
RuntimeConfig runtimeConfig = Defaults.runtimeConfigFor(command).processOutput(processOutput).build();
starter = MongodStarter.getInstance(runtimeConfig);
}
if (starter != null) {
MongodConfig mongodConfig = MongodConfig.builder().version(Version.Main.PRODUCTION).build();
executable = starter.prepare(mongodConfig);
MongodProcess mongodProcess = executable.start();
this.mongoPort = mongodProcess.getConfig().net().getPort();
}
}
Aggregations