This commit is contained in:
akulikov 2024-08-21 14:47:35 +03:00
parent 6e7fce1fe2
commit 77f8e2353b
3 changed files with 13 additions and 12 deletions

View file

@ -4,7 +4,6 @@ import java.beans.PropertyVetoException;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import ru.spcex.clearing.reports.config.settings.ReportsServiceSettings;
@ -35,16 +34,9 @@ public class ClearingImdgConfig {
}
@Bean
public ImdgProvider imdgProvider(ReportsServiceSettings settings, Environment env) throws PropertyVetoException {
String[] activeProfiles = env.getActiveProfiles();
boolean isDevProfile = false;
for (String profile : activeProfiles) {
if (profile.equalsIgnoreCase("DEV")) {
isDevProfile = true;
break;
}
}
if (!isDevProfile) {
public ImdgProvider imdgProvider(ReportsServiceSettings settings) throws PropertyVetoException {
boolean directDb = settings.getDirectDb() != null && settings.getDirectDb().getEnable();
if (!directDb) {
ThreadPoolTaskExecutor hazelcastClientInitializerPool = taskExecutorHazelcastClientInitializer();
ThreadPoolTaskExecutor idGeneratorAwaiterPool = taskExecutorIdGeneratorAwaiter();
return new HazelcastService(hazelcastClientInitializerPool, idGeneratorAwaiterPool, settings.getHazelcast());

View file

@ -7,6 +7,7 @@ public class DirectDB {
private String driver;
private String minPoolSize;
private String maxPoolSize;
private Boolean enable;
public String getLogin() {
return login;
@ -55,4 +56,12 @@ public class DirectDB {
public void setDriver(String driver) {
this.driver = driver;
}
public Boolean getEnable() {
return enable;
}
public void setEnable(Boolean enable) {
this.enable = enable;
}
}

View file

@ -35,10 +35,10 @@ reports-service.notifications-store.delete-after-send=true
reports-service.reports.pfx-class-codes=BKVC,SKVC,UKVC,NKVC,DKVC,BMVC,SMVC,UMVC,DMVC,MMVC,BMFC,SMFC,UMFC,DMFC,MMFC,BMMC,SMMC,UMMC,DMMC,MMMC,BMIC,SMIC,UMIC,DMIC,MMIC
reports-service.direct-db.enable=true
reports-service.direct-db.login=clearing
reports-service.direct-db.password=Aa111111
reports-service.direct-db.url=jdbc:postgresql://10.200.200.133:5432/clearing?currentSchema=clearing_prod
reports-service.direct-db.driver=org.postgresql.Driver
#reports-service.direct-db.url=jdbc:postgresql://10.200.200.133:5432/postgres?currentSchema=clearing_tester
reports-service.direct-db.min-pool-size=10
reports-service.direct-db.max-pool-size=30