From c20d37518d6a36db57ec174491fe7b6a512b7930 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com.> Date: Wed, 11 Dec 2024 22:09:35 +0000 Subject: [PATCH] prop fixes --- .../software/SPDF/SPdfApplication.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/SPdfApplication.java b/src/main/java/stirling/software/SPDF/SPdfApplication.java index 5b2c1bed..2258bb05 100644 --- a/src/main/java/stirling/software/SPDF/SPdfApplication.java +++ b/src/main/java/stirling/software/SPDF/SPdfApplication.java @@ -79,10 +79,15 @@ public class SPdfApplication { SpringApplication app = new SpringApplication(SPdfApplication.class); + Properties props = new Properties(); + if("true".equals(System.getenv("STIRLING_PDF_DESKTOP_UI"))) { System.setProperty("java.awt.headless", "false"); app.setHeadless(false); + props.put("java.awt.headless", "false"); + props.put("spring.main.web-application-type", "servlet"); } + app.setAdditionalProfiles("default"); app.addInitializers(new ConfigInitializer()); Map propertyFiles = new HashMap<>(); @@ -106,18 +111,12 @@ public class SPdfApplication { } else { logger.warn("Custom configuration file 'configs/custom_settings.yml' does not exist."); } - - if (!propertyFiles.isEmpty()) { - app.setDefaultProperties( - Collections.singletonMap( - "spring.config.additional-location", - propertyFiles.get("spring.config.additional-location"))); - } - - Properties props = new Properties(); - props.put("java.awt.headless", "false"); - props.put("spring.main.web-application-type", "servlet"); - app.setDefaultProperties(props); + Properties finalProps = new Properties(); + finalProps.putAll(Collections.singletonMap( + "spring.config.additional-location", + propertyFiles.get("spring.config.additional-location"))); + finalProps.putAll(props); + app.setDefaultProperties(finalProps); app.run(args);