mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-12 17:52:13 +02:00
Fixes #3428 external database
This commit is contained in:
parent
35ecff053a
commit
80d2d5e3a3
@ -240,8 +240,32 @@ public class DatabaseService implements DatabaseInterface {
|
|||||||
private boolean isH2Database() {
|
private boolean isH2Database() {
|
||||||
ApplicationProperties.Datasource datasource =
|
ApplicationProperties.Datasource datasource =
|
||||||
applicationProperties.getSystem().getDatasource();
|
applicationProperties.getSystem().getDatasource();
|
||||||
return !datasource.isEnableCustomDatabase()
|
|
||||||
|| datasource.getType().equalsIgnoreCase(ApplicationProperties.Driver.H2.name());
|
boolean isTypeH2 =
|
||||||
|
datasource.getType().equalsIgnoreCase(ApplicationProperties.Driver.H2.name());
|
||||||
|
boolean isDBUrlH2 =
|
||||||
|
datasource.getCustomDatabaseUrl().contains("h2")
|
||||||
|
|| datasource.getCustomDatabaseUrl().contains("H2");
|
||||||
|
|
||||||
|
if (isTypeH2 && !isDBUrlH2) {
|
||||||
|
log.warn(
|
||||||
|
"Datasource type is H2, but the URL does not contain 'h2'. "
|
||||||
|
+ "Please check your configuration.");
|
||||||
|
throw new IllegalStateException(
|
||||||
|
"Datasource type is H2, but the URL does not contain 'h2'. Please check your"
|
||||||
|
+ " configuration.");
|
||||||
|
} else if (!isTypeH2 && isDBUrlH2) {
|
||||||
|
log.warn(
|
||||||
|
"Datasource URL contains 'h2', but the type is not H2. "
|
||||||
|
+ "Please check your configuration.");
|
||||||
|
throw new IllegalStateException(
|
||||||
|
"Datasource URL contains 'h2', but the type is not H2. Please check your"
|
||||||
|
+ " configuration.");
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isH2 = isTypeH2 && isDBUrlH2;
|
||||||
|
|
||||||
|
return !datasource.isEnableCustomDatabase() || isH2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user