mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-07-28 13:47:43 +02:00
test
This commit is contained in:
parent
093b882141
commit
cf03bdc17b
@ -2,6 +2,7 @@ package stirling.software.SPDF;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
@ -77,7 +78,14 @@ public class SPdfApplication {
|
|||||||
props.put("spring.main.web-application-type", "servlet");
|
props.put("spring.main.web-application-type", "servlet");
|
||||||
}
|
}
|
||||||
app.setAdditionalProfiles("default");
|
app.setAdditionalProfiles("default");
|
||||||
app.addInitializers(new ConfigInitializer());
|
|
||||||
|
ConfigInitializer initializer = new ConfigInitializer();
|
||||||
|
try {
|
||||||
|
initializer.ensureConfigExists();
|
||||||
|
} catch (IOException | URISyntaxException e) {
|
||||||
|
log.error("Error initialising configuration", e);
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, String> propertyFiles = new HashMap<>();
|
Map<String, String> propertyFiles = new HashMap<>();
|
||||||
// External config files
|
// External config files
|
||||||
log.info("Settings file: {}", InstallationPathConfig.getSettingsPath());
|
log.info("Settings file: {}", InstallationPathConfig.getSettingsPath());
|
||||||
|
@ -22,18 +22,9 @@ import org.springframework.context.ConfigurableApplicationContext;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ConfigInitializer
|
public class ConfigInitializer {
|
||||||
implements ApplicationContextInitializer<ConfigurableApplicationContext> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize(ConfigurableApplicationContext applicationContext) {
|
|
||||||
try {
|
|
||||||
log.info("Setting up configs from templates");
|
|
||||||
ensureConfigExists();
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException("Failed to initialize application configuration", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ensureConfigExists() throws IOException, URISyntaxException {
|
public void ensureConfigExists() throws IOException, URISyntaxException {
|
||||||
// Define the path to the external config directory
|
// Define the path to the external config directory
|
||||||
@ -54,6 +45,7 @@ public class ConfigInitializer
|
|||||||
"Resource file not found: settings.yml.template");
|
"Resource file not found: settings.yml.template");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.info("Created settings file from template");
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Define the path to the config settings file
|
// Define the path to the config settings file
|
||||||
|
@ -41,7 +41,6 @@ import stirling.software.SPDF.model.provider.UnsupportedProviderException;
|
|||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConfigurationProperties(prefix = "")
|
@ConfigurationProperties(prefix = "")
|
||||||
@EnableConfigurationProperties(ApplicationProperties.class)
|
|
||||||
@Data
|
@Data
|
||||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
Loading…
Reference in New Issue
Block a user