pvillard31 commented on code in PR #9723:
URL: https://github.com/apache/nifi/pull/9723#discussion_r1958566721


##########
nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/main/java/org/apache/nifi/mongodb/MongoDBControllerService.java:
##########
@@ -90,8 +90,25 @@ protected MongoClient createClient(ConfigurationContext 
context, MongoClient exi
         }
 
         try {
-            final String uri = getURI(context);
-            final MongoClientSettings.Builder builder = getClientSettings(uri, 
sslContext);
+            final String uri = 
context.getProperty(URI).evaluateAttributeExpressions().getValue();
+            final String user = 
context.getProperty(DB_USER).evaluateAttributeExpressions().getValue();
+            final String passw = 
context.getProperty(DB_PASSWORD).evaluateAttributeExpressions().getValue();
+
+            final MongoClientSettings.Builder builder = 
MongoClientSettings.builder();
+
+            final ConnectionString cs = new ConnectionString(uri);
+            final String database = cs.getDatabase();
+
+            if (user != null && passw != null) {
+                builder.credential(MongoCredential.createCredential(user, 
database == null ? database : "admin", passw.toCharArray()));

Review Comment:
   Thanks, I pushed a commit to address your comment... the database name 
evaluation was wrong so I fixed this as well...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to