mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2026-11-14 00:14:05 +00:00
Use connection uri database if set for Mongo (#4289)
This commit is contained in:
1 file changed
+8
-3
+8
-3
@@ -124,7 +124,12 @@ public class MongoStorage implements StorageImplementation {
|
||||
.uuidRepresentation(UuidRepresentation.JAVA_LEGACY);
|
||||
|
||||
if (!Strings.isNullOrEmpty(this.connectionUri)) {
|
||||
this.mongoClient = new MongoClient(new MongoClientURI(this.connectionUri, options));
|
||||
MongoClientURI uri = new MongoClientURI(this.connectionUri, options);
|
||||
this.mongoClient = new MongoClient(uri);
|
||||
|
||||
String databaseName = uri.getDatabase() != null ? uri.getDatabase() : this.configuration.getDatabase();
|
||||
this.database = this.mongoClient.getDatabase(databaseName);
|
||||
|
||||
} else {
|
||||
MongoCredential credential = null;
|
||||
if (!Strings.isNullOrEmpty(this.configuration.getUsername())) {
|
||||
@@ -148,9 +153,9 @@ public class MongoStorage implements StorageImplementation {
|
||||
} else {
|
||||
this.mongoClient = new MongoClient(address, credential, options.build());
|
||||
}
|
||||
|
||||
this.database = this.mongoClient.getDatabase(this.configuration.getDatabase());
|
||||
}
|
||||
|
||||
this.database = this.mongoClient.getDatabase(this.configuration.getDatabase());
|
||||
|
||||
try {
|
||||
ensureIndexes();
|
||||
|
||||
Reference in new issue
Block a user