From 1e8dff22bf3c4be347966ab21a68c805c1e10bce Mon Sep 17 00:00:00 2001 From: DarioGii Date: Sun, 8 Dec 2024 21:55:53 +0000 Subject: [PATCH] #2270 config for DB variants --- build.gradle | 16 +---- .../interfaces/DatabaseBackupInterface.java | 2 + .../config/security/InitialSecuritySetup.java | 20 +++--- .../security/database/DataSourceConfig.java | 29 +++++++++ ...Helper.java => DatabaseBackupService.java} | 61 +++++++++++++------ .../security/database/DatabaseConfig.java | 35 +++++++++++ .../config/security/database/JpaConfig.java | 20 ++++++ .../security/database/ScheduledTasks.java | 2 +- .../controller/api/DatabaseController.java | 14 ++--- .../controller/web/DatabaseWebController.java | 8 +-- .../SPDF/model/ApplicationProperties.java | 2 +- .../software/SPDF/model/Authority.java | 2 +- .../software/SPDF/model/PersistentLogin.java | 2 +- .../software/SPDF/model/SessionEntity.java | 2 +- .../stirling/software/SPDF/model/User.java | 2 +- .../resources/application-mysql.properties | 11 ++++ .../resources/application-oracle.properties | 11 ++++ .../resources/application-postgres.properties | 11 ++++ src/main/resources/application.properties | 12 +--- src/main/resources/settings.yml.template | 8 +-- 20 files changed, 197 insertions(+), 73 deletions(-) create mode 100644 src/main/java/stirling/software/SPDF/config/security/database/DataSourceConfig.java rename src/main/java/stirling/software/SPDF/config/security/database/{DatabaseBackupHelper.java => DatabaseBackupService.java} (83%) create mode 100644 src/main/java/stirling/software/SPDF/config/security/database/DatabaseConfig.java create mode 100644 src/main/java/stirling/software/SPDF/config/security/database/JpaConfig.java create mode 100644 src/main/resources/application-mysql.properties create mode 100644 src/main/resources/application-oracle.properties create mode 100644 src/main/resources/application-postgres.properties diff --git a/build.gradle b/build.gradle index 9521b629881..e8af68909c5 100644 --- a/build.gradle +++ b/build.gradle @@ -240,7 +240,7 @@ dependencies { tasks.withType(JavaCompile).configureEach { options.encoding = "UTF-8" dependsOn "spotlessApply" - dependsOn "initDB" +// dependsOn "initDB" } compileJava { @@ -253,20 +253,6 @@ bootRun { } } - -tasks.register("initDB", Exec) { - description = "Creates a database of the specified type (postgresql, mysql, oracle)." - def scriptPath = "$projectDir/scripts/init_db.sh" - // Set the database type argument - def dbType = project.hasProperty('dbType') ? project.property('dbType') : "postgresql" - - if (!["postgresql", "mysql", "oracle"].contains(dbType)) { - throw new GradleException("Invalid database type: $dbType. Valid types are: postgresql, mysql, oracle.") - } else { - commandLine "bash", scriptPath, dbType - } -} - task writeVersion { def propsFile = file("src/main/resources/version.properties") def props = new Properties() diff --git a/src/main/java/stirling/software/SPDF/config/interfaces/DatabaseBackupInterface.java b/src/main/java/stirling/software/SPDF/config/interfaces/DatabaseBackupInterface.java index 9a8ed943990..36ec92cef1a 100644 --- a/src/main/java/stirling/software/SPDF/config/interfaces/DatabaseBackupInterface.java +++ b/src/main/java/stirling/software/SPDF/config/interfaces/DatabaseBackupInterface.java @@ -6,6 +6,8 @@ import stirling.software.SPDF.utils.FileInfo; public interface DatabaseBackupInterface { + void setAdminUser(); + void exportDatabase() throws IOException; void importDatabase(); diff --git a/src/main/java/stirling/software/SPDF/config/security/InitialSecuritySetup.java b/src/main/java/stirling/software/SPDF/config/security/InitialSecuritySetup.java index 3bbc7551fe4..b117a5424b5 100644 --- a/src/main/java/stirling/software/SPDF/config/security/InitialSecuritySetup.java +++ b/src/main/java/stirling/software/SPDF/config/security/InitialSecuritySetup.java @@ -16,22 +16,26 @@ @Slf4j public class InitialSecuritySetup { + public static final String POSTGRES = "postgres"; + @Autowired private UserService userService; @Autowired private ApplicationProperties applicationProperties; - @Autowired private DatabaseBackupInterface databaseBackupHelper; + @Autowired private DatabaseBackupInterface databaseBackupService; @PostConstruct public void init() throws IllegalArgumentException, IOException { - if (databaseBackupHelper.hasBackup() && userService.hasUsers()) { - databaseBackupHelper.importDatabase(); - } else if (!userService.hasUsers()) { + if (applicationProperties.getSystem().getEnvironmentName().equals(POSTGRES)) { + log.debug("PostgreSQL configuration settings detected. Creating admin user"); + databaseBackupService.setAdminUser(); + } + + if (!userService.hasUsers()) { initializeAdminUser(); - } else { - databaseBackupHelper.exportDatabase(); - userService.migrateOauth2ToSSO(); } + + userService.migrateOauth2ToSSO(); initializeInternalApiUser(); } @@ -73,7 +77,7 @@ private void initializeInternalApiUser() throws IllegalArgumentException, IOExce UUID.randomUUID().toString(), Role.INTERNAL_API_USER.getRoleId()); userService.addApiKeyToUser(Role.INTERNAL_API_USER.getRoleId()); - log.info("Internal API user created: " + Role.INTERNAL_API_USER.getRoleId()); + log.info("Internal API user created: {}", Role.INTERNAL_API_USER.getRoleId()); } userService.syncCustomApiUser(applicationProperties.getSecurity().getCustomGlobalAPIKey()); System.out.println(applicationProperties.getSecurity().getCustomGlobalAPIKey()); diff --git a/src/main/java/stirling/software/SPDF/config/security/database/DataSourceConfig.java b/src/main/java/stirling/software/SPDF/config/security/database/DataSourceConfig.java new file mode 100644 index 00000000000..6e68ff22927 --- /dev/null +++ b/src/main/java/stirling/software/SPDF/config/security/database/DataSourceConfig.java @@ -0,0 +1,29 @@ +package stirling.software.SPDF.config.security.database; + +import javax.sql.DataSource; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.jdbc.DataSourceBuilder; +import org.springframework.context.annotation.Configuration; + +import lombok.Data; + +@Data +@Configuration +@ConfigurationProperties(prefix = "spring.datasource") +public class DataSourceConfig { + + private String driverClassName; + private String url; + private String username; + private String password; + + public DataSource dataSource() { + DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create(); + dataSourceBuilder.driverClassName(driverClassName); + dataSourceBuilder.url(url); + dataSourceBuilder.username(username); + dataSourceBuilder.password(password); + return dataSourceBuilder.build(); + } +} diff --git a/src/main/java/stirling/software/SPDF/config/security/database/DatabaseBackupHelper.java b/src/main/java/stirling/software/SPDF/config/security/database/DatabaseBackupService.java similarity index 83% rename from src/main/java/stirling/software/SPDF/config/security/database/DatabaseBackupHelper.java rename to src/main/java/stirling/software/SPDF/config/security/database/DatabaseBackupService.java index d4af3b05998..91026cf687f 100644 --- a/src/main/java/stirling/software/SPDF/config/security/database/DatabaseBackupHelper.java +++ b/src/main/java/stirling/software/SPDF/config/security/database/DatabaseBackupService.java @@ -7,7 +7,6 @@ import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributes; import java.sql.Connection; -import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; @@ -20,12 +19,12 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Configuration; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.PathResource; import org.springframework.core.io.support.EncodedResource; import org.springframework.jdbc.datasource.init.ScriptException; import org.springframework.jdbc.datasource.init.ScriptUtils; +import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; import stirling.software.SPDF.config.interfaces.DatabaseBackupInterface; @@ -33,25 +32,49 @@ import stirling.software.SPDF.utils.FileInfo; @Slf4j -@Configuration -public class DatabaseBackupHelper implements DatabaseBackupInterface { +@Service +public class DatabaseBackupService implements DatabaseBackupInterface { public static final String BACKUP_PREFIX = "backup_"; public static final String SQL_SUFFIX = ".sql"; + private static final Path BACKUP_PATH = Paths.get("configs/db/backup/"); - @Value("${dbType:postgresql}") - private String dbType; + @Autowired private DatabaseConfig databaseConfig; - @Value("${spring.datasource.url}") - private String url; - - @Value("${spring.datasource.username}") - private String username; - - @Value("${spring.datasource.password}") - private String password; + @Override + public void setAdminUser() { + String adminScript = + """ + DO + $do$ + BEGIN + IF EXISTS ( + SELECT FROM pg_catalog.pg_roles + WHERE rolname = 'admin') THEN + + RAISE NOTICE 'Role "admin" already exists. Skipping.'; + ELSE + CREATE USER admin WITH ENCRYPTED PASSWORD 'stirling'; + END IF; + END + $do$; + + CREATE SCHEMA IF NOT EXISTS stirling_pdf AUTHORIZATION admin; + GRANT ALL PRIVILEGES ON DATABASE postgres TO admin; + ALTER DATABASE postgres SET search_path TO stirling_pdf; + ALTER USER admin SET search_path TO stirling_pdf; + """ + .trim(); + + try (Connection connection = databaseConfig.connection(); + Statement statement = connection.createStatement()) { + statement.execute(adminScript); + } catch (SQLException e) { + log.error("Error: Failed to create admin user for database", e); + } - private final Path BACKUP_PATH = Paths.get("configs/db/backup/"); + log.info("Created admin user for database"); + } @Override public boolean hasBackup() { @@ -154,7 +177,7 @@ public void exportDatabase() { Path insertOutputFilePath = this.getBackupFilePath(BACKUP_PREFIX + dateNow.format(myFormatObj) + SQL_SUFFIX); - try (Connection conn = DriverManager.getConnection(url, username, password)) { + try (Connection conn = databaseConfig.connection()) { ScriptUtils.executeSqlScript( conn, new EncodedResource(new PathResource(insertOutputFilePath))); @@ -183,7 +206,7 @@ private static void deleteOldestBackup(List filteredBackupList) { // Retrieves the H2 database version. public String getH2Version() { String version = "Unknown"; - try (Connection conn = DriverManager.getConnection(url, username, password)) { + try (Connection conn = databaseConfig.connection()) { try (Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SELECT H2VERSION() AS version")) { if (rs.next()) { @@ -223,7 +246,7 @@ public Path getBackupFilePath(String fileName) { } private void executeDatabaseScript(Path scriptPath) { - try (Connection conn = DriverManager.getConnection(url, username, password)) { + try (Connection conn = databaseConfig.connection()) { ScriptUtils.executeSqlScript(conn, new EncodedResource(new PathResource(scriptPath))); log.info("Database import completed: {}", scriptPath); diff --git a/src/main/java/stirling/software/SPDF/config/security/database/DatabaseConfig.java b/src/main/java/stirling/software/SPDF/config/security/database/DatabaseConfig.java new file mode 100644 index 00000000000..c062d815435 --- /dev/null +++ b/src/main/java/stirling/software/SPDF/config/security/database/DatabaseConfig.java @@ -0,0 +1,35 @@ +package stirling.software.SPDF.config.security.database; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import lombok.Getter; + +@Getter +@Configuration +public class DatabaseConfig { + + @Autowired private DataSourceConfig dataSourceConfig; + + @Autowired private JpaConfig jpaConfig; + + @Bean + public DataSource dataSource() { + return dataSourceConfig.dataSource(); + } + + @Bean + public Connection connection() throws SQLException { + return DriverManager.getConnection( + dataSourceConfig.getUrl(), + dataSourceConfig.getUsername(), + dataSourceConfig.getPassword()); + } +} diff --git a/src/main/java/stirling/software/SPDF/config/security/database/JpaConfig.java b/src/main/java/stirling/software/SPDF/config/security/database/JpaConfig.java new file mode 100644 index 00000000000..f3edc531b2b --- /dev/null +++ b/src/main/java/stirling/software/SPDF/config/security/database/JpaConfig.java @@ -0,0 +1,20 @@ +package stirling.software.SPDF.config.security.database; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import lombok.Data; + +@Data +@Configuration +@ConfigurationProperties(prefix = "spring.jpa") +public class JpaConfig { + + @Value("${environment.name}") + private String environmentName; + + private String databasePlatform; + private String openInView; + private String generateDDL; +} diff --git a/src/main/java/stirling/software/SPDF/config/security/database/ScheduledTasks.java b/src/main/java/stirling/software/SPDF/config/security/database/ScheduledTasks.java index 2ddc47e12a3..ca5d272009a 100644 --- a/src/main/java/stirling/software/SPDF/config/security/database/ScheduledTasks.java +++ b/src/main/java/stirling/software/SPDF/config/security/database/ScheduledTasks.java @@ -9,7 +9,7 @@ @Component public class ScheduledTasks { - @Autowired private DatabaseBackupHelper databaseBackupService; + @Autowired private DatabaseBackupService databaseBackupService; @Scheduled(cron = "0 0 0 * * ?") public void performBackup() throws IOException { diff --git a/src/main/java/stirling/software/SPDF/controller/api/DatabaseController.java b/src/main/java/stirling/software/SPDF/controller/api/DatabaseController.java index 83d37b8cfa9..0f98952a75b 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/DatabaseController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/DatabaseController.java @@ -28,7 +28,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; -import stirling.software.SPDF.config.security.database.DatabaseBackupHelper; +import stirling.software.SPDF.config.security.database.DatabaseBackupService; @Slf4j @Controller @@ -37,7 +37,7 @@ @Tag(name = "Database", description = "Database APIs") public class DatabaseController { - @Autowired DatabaseBackupHelper databaseBackupHelper; + @Autowired DatabaseBackupService databaseBackupService; @Hidden @PostMapping(consumes = "multipart/form-data", value = "import-database") @@ -56,7 +56,7 @@ public String importDatabase( try (InputStream in = file.getInputStream()) { Files.copy(in, tempTemplatePath, StandardCopyOption.REPLACE_EXISTING); boolean importSuccess = - databaseBackupHelper.importDatabaseFromUI(tempTemplatePath.toString()); + databaseBackupService.importDatabaseFromUI(tempTemplatePath.toString()); if (importSuccess) { redirectAttributes.addAttribute("infoMessage", "importIntoDatabaseSuccessed"); } else { @@ -79,14 +79,14 @@ public String importDatabaseFromBackupUI(@PathVariable String fileName) // Check if the file exists in the backup list boolean fileExists = - databaseBackupHelper.getBackupList().stream() + databaseBackupService.getBackupList().stream() .anyMatch(backup -> backup.getFileName().equals(fileName)); if (!fileExists) { log.error("File {} not found in backup list", fileName); return "redirect:/database?error=fileNotFound"; } log.info("Received file: {}", fileName); - if (databaseBackupHelper.importDatabaseFromUI(fileName)) { + if (databaseBackupService.importDatabaseFromUI(fileName)) { log.info("File {} imported to database", fileName); return "redirect:/database?infoMessage=importIntoDatabaseSuccessed"; } @@ -104,7 +104,7 @@ public String deleteFile(@PathVariable String fileName) { throw new IllegalArgumentException("File must not be null or empty"); } try { - if (databaseBackupHelper.deleteBackupFile(fileName)) { + if (databaseBackupService.deleteBackupFile(fileName)) { log.info("Deleted file: {}", fileName); } else { log.error("Failed to delete file: {}", fileName); @@ -128,7 +128,7 @@ public ResponseEntity downloadFile(@PathVariable String fileName) { throw new IllegalArgumentException("File must not be null or empty"); } try { - Path filePath = databaseBackupHelper.getBackupFilePath(fileName); + Path filePath = databaseBackupService.getBackupFilePath(fileName); InputStreamResource resource = new InputStreamResource(Files.newInputStream(filePath)); return ResponseEntity.ok() .header(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + fileName) diff --git a/src/main/java/stirling/software/SPDF/controller/web/DatabaseWebController.java b/src/main/java/stirling/software/SPDF/controller/web/DatabaseWebController.java index 5f521b50e39..6ee489c782e 100644 --- a/src/main/java/stirling/software/SPDF/controller/web/DatabaseWebController.java +++ b/src/main/java/stirling/software/SPDF/controller/web/DatabaseWebController.java @@ -12,14 +12,14 @@ import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; -import stirling.software.SPDF.config.security.database.DatabaseBackupHelper; +import stirling.software.SPDF.config.security.database.DatabaseBackupService; import stirling.software.SPDF.utils.FileInfo; @Controller @Tag(name = "Database Management", description = "Database management and security APIs") public class DatabaseWebController { - @Autowired private DatabaseBackupHelper databaseBackupHelper; + @Autowired private DatabaseBackupService databaseBackupService; @PreAuthorize("hasRole('ROLE_ADMIN')") @GetMapping("/database") @@ -33,10 +33,10 @@ public String database(HttpServletRequest request, Model model, Authentication a model.addAttribute("infoMessage", confirmed); } - List backupList = databaseBackupHelper.getBackupList(); + List backupList = databaseBackupService.getBackupList(); model.addAttribute("backupFiles", backupList); - model.addAttribute("databaseVersion", databaseBackupHelper.getH2Version()); + model.addAttribute("databaseVersion", databaseBackupService.getH2Version()); return "database"; } diff --git a/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java b/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java index 549297ae6c1..4e85a94e940 100644 --- a/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java +++ b/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java @@ -247,13 +247,13 @@ public static class System { private String tessdataDir; private Boolean enableAlphaFunctionality; private String enableAnalytics; + private String environmentName; private Datasource datasource; } @Data public static class Datasource { private String url; - private Driver driver; private String username; private String password; } diff --git a/src/main/java/stirling/software/SPDF/model/Authority.java b/src/main/java/stirling/software/SPDF/model/Authority.java index 8dd6d6e742f..337db49b1f3 100644 --- a/src/main/java/stirling/software/SPDF/model/Authority.java +++ b/src/main/java/stirling/software/SPDF/model/Authority.java @@ -12,7 +12,7 @@ import jakarta.persistence.Table; @Entity -@Table(name = "authorities") +@Table(name = "authorities", schema = "stirling_pdf") public class Authority implements Serializable { private static final long serialVersionUID = 1L; diff --git a/src/main/java/stirling/software/SPDF/model/PersistentLogin.java b/src/main/java/stirling/software/SPDF/model/PersistentLogin.java index cc94eea28d2..c5f075e5fc8 100644 --- a/src/main/java/stirling/software/SPDF/model/PersistentLogin.java +++ b/src/main/java/stirling/software/SPDF/model/PersistentLogin.java @@ -8,7 +8,7 @@ import jakarta.persistence.Table; @Entity -@Table(name = "persistent_logins") +@Table(name = "persistent_logins", schema = "stirling_pdf") public class PersistentLogin { @Id diff --git a/src/main/java/stirling/software/SPDF/model/SessionEntity.java b/src/main/java/stirling/software/SPDF/model/SessionEntity.java index 3b4989d5ac6..b5853685cde 100644 --- a/src/main/java/stirling/software/SPDF/model/SessionEntity.java +++ b/src/main/java/stirling/software/SPDF/model/SessionEntity.java @@ -11,7 +11,7 @@ @Entity @Data -@Table(name = "sessions") +@Table(name = "sessions", schema = "stirling_pdf") public class SessionEntity implements Serializable { @Id private String sessionId; diff --git a/src/main/java/stirling/software/SPDF/model/User.java b/src/main/java/stirling/software/SPDF/model/User.java index b3cfa129d0e..77852de1d2a 100644 --- a/src/main/java/stirling/software/SPDF/model/User.java +++ b/src/main/java/stirling/software/SPDF/model/User.java @@ -10,7 +10,7 @@ import jakarta.persistence.*; @Entity -@Table(name = "users") +@Table(name = "users", schema = "stirling_pdf") public class User implements Serializable { private static final long serialVersionUID = 1L; diff --git a/src/main/resources/application-mysql.properties b/src/main/resources/application-mysql.properties new file mode 100644 index 00000000000..fa35282e444 --- /dev/null +++ b/src/main/resources/application-mysql.properties @@ -0,0 +1,11 @@ +environment.name=mysql + +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.url=jdbc:mysql://localhost:3306/stirling_pdf?createDatabaseIfNotExist=true +spring.datasource.username=admin +spring.datasource.password=stirling +spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect +spring.jpa.open-in-view=false +spring.jpa.generate-ddl=true +spring.jpa.hibernate.ddl-auto=update +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect diff --git a/src/main/resources/application-oracle.properties b/src/main/resources/application-oracle.properties new file mode 100644 index 00000000000..be48037ffbd --- /dev/null +++ b/src/main/resources/application-oracle.properties @@ -0,0 +1,11 @@ +environment.name=oracle + +spring.datasource.driver-class-name=oracle.jdbc.OracleDriver +spring.datasource.url=jdbc:oracle:thin:@localhost:1521:stirling_pdf +spring.datasource.username=admin +spring.datasource.password=stirling +spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect +spring.jpa.open-in-view=false +spring.jpa.generate-ddl=true +spring.jpa.hibernate.ddl-auto=update +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.Oracle10gDialect diff --git a/src/main/resources/application-postgres.properties b/src/main/resources/application-postgres.properties new file mode 100644 index 00000000000..7c20aa4adec --- /dev/null +++ b/src/main/resources/application-postgres.properties @@ -0,0 +1,11 @@ +environment.name=postgres + +spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.url=jdbc:postgresql://localhost:5432/postgres +spring.datasource.username=postgres +spring.datasource.password=postgres +spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect +spring.jpa.open-in-view=false +spring.jpa.generate-ddl=true +spring.jpa.hibernate.ddl-auto=update +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index c37444b940b..09db2f9ea8a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,3 +1,5 @@ +spring.profiles.active=postgres + multipart.enabled=true logging.level.org.springframework=WARN @@ -39,16 +41,6 @@ spring.mvc.async.request-timeout=${SYSTEM_CONNECTIONTIMEOUTMILLISECONDS:1200000} #spring.thymeleaf.prefix=file:/customFiles/templates/,classpath:/templates/ #spring.thymeleaf.cache=false -spring.datasource.url=jdbc:postgresql://localhost:5432/stirling_pdf -# postgresql | oracle | mysql -spring.datasource.driver=postgresql -spring.datasource.username=admin -spring.datasource.password=stirling -spring.jpa.open-in-view=false -spring.jpa.generate-ddl=true -spring.jpa.hibernate.ddl-auto=update -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect -spring.flyway.baselineOneMigrate=true server.servlet.session.timeout=30m # Change the default URL path for OpenAPI JSON springdoc.api-docs.path=/v1/api-docs diff --git a/src/main/resources/settings.yml.template b/src/main/resources/settings.yml.template index 6303a05c955..e676afa56ac 100644 --- a/src/main/resources/settings.yml.template +++ b/src/main/resources/settings.yml.template @@ -85,11 +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 + environmentName: postgres # set the default environment (e.g. 'postgres', 'mysql', 'oracle') datasource: - driver: postgresql - url: jdbc:postgresql://localhost:5432/stirling_pdf - username: admin - password: stirling + url: jdbc:postgresql://localhost:5432/postgres + username: postgres + password: postgres ui: appName: '' # application's visible name