Skip to content

Commit 0c01c80

Browse files
Malandrilgeoand
authored and
Thomas Canava
committed
Apply suggestions from code review
Co-authored-by: Georgios Andrianakis <[email protected]>
1 parent ad1a181 commit 0c01c80

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

Diff for: docs/src/main/asciidoc/liquibase-mongodb.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ quarkus.liquibase-mongodb.migrate-at-start=true
8282
----
8383
NOTE: Liquibase needs a database either in the connection string or with the `quarkus.mongodb.database` property.
8484

85-
NOTE: By default, Liquibase MongoDB is configured to use the default MongoDB client you can change the client with `quarkus.liquibase-mongodb.mongodb-client`.
85+
NOTE: By default, Liquibase MongoDB is configured to use the default MongoDB client Quarkus creates, but you can configure the extension to use a named client by setting `quarkus.liquibase-mongodb.mongo-client-name`.
8686

8787
Add a changeLog file to the default folder following the Liquibase naming conventions: `{change-log}`
8888
YAML, JSON and XML formats are supported for the changeLog.

Diff for: extensions/liquibase-mongodb/runtime/src/main/java/io/quarkus/liquibase/mongodb/LiquibaseMongodbFactory.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ private String parseChangeLog(String changeLog) {
8989

9090
public Liquibase createLiquibase() {
9191
try (ResourceAccessor resourceAccessor = resolveResourceAccessor()) {
92-
MongoClients clients = Arc.container().select(MongoClients.class).stream().findFirst().orElseThrow();
92+
MongoClients mongoClients = Arc.container().instance(MongoClients.class).get();
9393
String mongoClientName;
9494
MongoClientConfig mongoClientConfig;
95-
if (liquibaseMongodbConfig.mongodbClient().isPresent()) {
96-
mongoClientName = liquibaseMongodbConfig.mongodbClient().get();
95+
if (liquibaseMongodbConfig.mongoClientName().isPresent()) {
96+
mongoClientName = liquibaseMongodbConfig.mongoClientName().get();
9797
mongoClientConfig = mongodbConfig.mongoClientConfigs().get(mongoClientName);
9898
if (mongoClientConfig == null) {
9999
throw new IllegalArgumentException("Mongo client named '%s' not found".formatted(mongoClientName));
@@ -114,7 +114,7 @@ public Liquibase createLiquibase() {
114114
"be defined when no database exist in the connection string");
115115
}
116116
}
117-
Database database = createDatabase(clients, mongoClientName, maybeDatabase.get());
117+
Database database = createDatabase(mongoClients, mongoClientName, maybeDatabase.get());
118118
if (liquibaseMongodbConfig.liquibaseCatalogName().isPresent()) {
119119
database.setLiquibaseCatalogName(liquibaseMongodbConfig.liquibaseCatalogName().get());
120120
}

Diff for: extensions/liquibase-mongodb/runtime/src/main/java/io/quarkus/liquibase/mongodb/runtime/LiquibaseMongodbConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public interface LiquibaseMongodbConfig {
2626
/**
2727
* Mongodb client name to use to connect to database, defaults to the default mongodb client.
2828
*/
29-
Optional<String> mongodbClient();
29+
Optional<String> mongoClientName();
3030

3131
/**
3232
* The migrate at start flag

Diff for: integration-tests/liquibase-mongodb/src/main/resources/application.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ quarkus.mongodb.devservices.enabled=false
33

44
quarkus.liquibase-mongodb.change-log=liquibase/changelog.xml
55
quarkus.liquibase-mongodb.migrate-at-start=true
6-
quarkus.liquibase-mongodb.mongodb-client=fruit-client
6+
quarkus.liquibase-mongodb.mongo-client-name=fruit-client
77
quarkus.mongodb.fruit-client.database=fruits
88
quarkus.mongodb.fruit-client.hosts=localhost:27018

0 commit comments

Comments
 (0)