diff --git a/build.gradle b/build.gradle index a65af412..8a80900f 100644 --- a/build.gradle +++ b/build.gradle @@ -300,7 +300,7 @@ dependencies { implementation 'com.unboundid.product.scim2:scim2-sdk-client:2.3.5' // Don't upgrade h2database - runtimeOnly "com.h2database:h2:2.3.232" + runtimeOnly "org.postgresql:postgresql:42.7.4" constraints { implementation "org.opensaml:opensaml-core:$openSamlVersion" implementation "org.opensaml:opensaml-saml-api:$openSamlVersion" diff --git a/src/main/java/stirling/software/SPDF/config/security/database/DatabaseBackupHelper.java b/src/main/java/stirling/software/SPDF/config/security/database/DatabaseBackupHelper.java index 5db05bed..252e24e2 100644 --- a/src/main/java/stirling/software/SPDF/config/security/database/DatabaseBackupHelper.java +++ b/src/main/java/stirling/software/SPDF/config/security/database/DatabaseBackupHelper.java @@ -110,6 +110,7 @@ public class DatabaseBackupHelper implements DatabaseBackupInterface { return executeDatabaseScript(Paths.get(backupList.get(0).getFilePath())); } + // fixMe: Needs to check the type of DB before executing script @Override public void exportDatabase() throws IOException { // Check if the backup directory exists, and create it if it does not diff --git a/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java b/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java index 3b2d6176..5d498be8 100644 --- a/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java +++ b/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java @@ -6,6 +6,7 @@ import java.net.HttpURLConnection; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; +import java.sql.Driver; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -247,6 +248,28 @@ public class ApplicationProperties { private String tessdataDir; private Boolean enableAlphaFunctionality; private String enableAnalytics; + private Datasource datasource; + } + + @Data + public static class Datasource { + private String url; + private Driver driver; + private String username; + private String password; + } + + public enum Driver { + H2("h2"), + POSTGRESQL("postgresql"), + ORACLE("oracle"), + MY_SQL("mysql"); + + private final String driverName; + + Driver(String driverName) { + this.driverName = driverName; + } } @Data diff --git a/src/main/resources/settings.yml.template b/src/main/resources/settings.yml.template index a110744a..dcd94080 100644 --- a/src/main/resources/settings.yml.template +++ b/src/main/resources/settings.yml.template @@ -85,6 +85,11 @@ system: customHTMLFiles: false # enable to have files placed in /customFiles/templates override the existing template HTML files tessdataDir: /usr/share/tessdata # path to the directory containing the Tessdata files. This setting is relevant for Windows systems. For Windows users, this path should be adjusted to point to the appropriate directory where the Tessdata files are stored. enableAnalytics: undefined # set to 'true' to enable analytics, set to 'false' to disable analytics; for enterprise users, this is set to true + datasource: + url: jdbc:postgresql://localhost:5432/stirling-pdf-DB + driver: postgresql + username: postgres + password: ui: appName: '' # application's visible name