2270: Adding postgresql

This commit is contained in:
Dario Ghunney Ware 2024-12-04 14:14:28 +00:00 committed by DarioGii
parent e3d2bd3b1b
commit a2c30b6d2f
6 changed files with 37 additions and 6 deletions

View File

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

View File

@ -20,6 +20,7 @@ public class InitialSecuritySetup {
@Autowired private ApplicationProperties applicationProperties;
// todo: wip add Postgres here
@Autowired private DatabaseBackupInterface databaseBackupHelper;
@PostConstruct

View File

@ -115,6 +115,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

View File

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

View File

@ -41,13 +41,14 @@ spring.mvc.async.request-timeout=${SYSTEM_CONNECTIONTIMEOUTMILLISECONDS:1200000}
#spring.thymeleaf.prefix=file:/customFiles/templates/,classpath:/templates/
#spring.thymeleaf.cache=false
spring.datasource.url=jdbc:h2:file:./configs/stirling-pdf-DB-2.3.232;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa
spring.datasource.url=jdbc:postgresql://localhost:5432/stirling-pdf-DB
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.username=postgres
spring.datasource.password=
spring.h2.console.enabled=false
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update
server.servlet.session.timeout: 30m
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
server.servlet.session.timeout=30m
# Change the default URL path for OpenAPI JSON
springdoc.api-docs.path=/v1/api-docs

View File

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