josehernandezfintecheandomx commented on code in PR #2344:
URL: https://github.com/apache/fineract/pull/2344#discussion_r889414795
##########
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:
Yes! And It's already considered in the code too. The logic is to take the
current properties as default, but If the instance is ReadOnly we'll get the
readonly values from the next three places:
1. Database table field values,
2. System env property, If the previous is null
3. Reuse the Database table field values (non readonly) If the previous are
null
<img width="1384" alt="Screen Shot 2022-06-03 at 18 40 31"
src="https://user-images.githubusercontent.com/44206706/171967197-e4cc07ef-4e25-4e35-8ce8-b8d88a6540a9.png">
--
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]