[mongodb] devservice executed when host provided #40414
Closed
Description
opened on May 2, 2024
Description
When the quarkus.mongodb.connection-string
is provided the mongo devservice do not launch a container because the developer wants to use the mongo instance provided.
This behavior is defined here: https://github.com/quarkusio/quarkus/blob/main/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/DevServicesMongoProcessor.java#L150
When the quarkus.mongodb.hosts
is used to define a connection instead of quarkus.mongodb.connection-string
a mongo container is created and started by the devservice at startup. Is it possible to not start a container to use the hosts provided ?
Implementation ideas
Replace this:
boolean needToStart = !ConfigUtils.isPropertyPresent(configPrefix + "connection-string");
by
boolean needToStart = !ConfigUtils.isPropertyPresent(configPrefix + "connection-string") && !ConfigUtils.isPropertyPresent(configPrefix + "hosts");
Activity