adamsaghy commented on code in PR #2344:
URL: https://github.com/apache/fineract/pull/2344#discussion_r886520960


##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/TomcatJdbcDataSourcePerTenantService.java:
##########
@@ -80,15 +86,28 @@ public DataSource retrieveDataSource() {
     // creates the tenant data source for the oltp and report database
     private DataSource createNewDataSourceFor(final 
FineractPlatformTenantConnection tenantConnectionObj) {
         String protocol = toProtocol(this.tenantDataSource);
-        String jdbcUrl = toJdbcUrl(protocol, 
tenantConnectionObj.getSchemaServer(), 
tenantConnectionObj.getSchemaServerPort(),
-                tenantConnectionObj.getSchemaName(), 
tenantConnectionObj.getSchemaConnectionParameters());
+        // Default properties for Writing
+        String schemaServer = tenantConnectionObj.getSchemaServer();
+        String schemaPort = tenantConnectionObj.getSchemaServerPort();
+        String schemaName = tenantConnectionObj.getSchemaName();
+        String schemaUsername = tenantConnectionObj.getSchemaUsername();
+        String schemaPassword = tenantConnectionObj.getSchemaPassword();
+        // Properties to ReadOnly case
+        if (this.fineractProperties.getMode().isReadOnlyMode()) {
+            schemaServer = tenantConnectionObj.getReadOnlySchemaServer();
+            schemaPort = tenantConnectionObj.getReadOnlySchemaServerPort();
+            schemaName = tenantConnectionObj.getReadOnlySchemaName();
+            schemaUsername = tenantConnectionObj.getReadOnlySchemaUsername();
+            schemaPassword = tenantConnectionObj.getReadOnlySchemaPassword();
+        }
+        String jdbcUrl = toJdbcUrl(protocol, schemaServer, schemaPort, 
schemaName, tenantConnectionObj.getSchemaConnectionParameters());

Review Comment:
   Yeah...true. that one was missing from the POC as well...
   However can it happen the connection parameters to be different from the 
"original"? I mean "similar" DB, same data.



-- 
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