mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2024-06-03 06:10:11 +02:00
Compare commits
3 Commits
826db44a1d
...
aa13e10a26
Author | SHA1 | Date | |
---|---|---|---|
|
aa13e10a26 | ||
|
146b8f0103 | ||
|
28e0be145d |
|
@ -89,7 +89,7 @@ dependencies {
|
|||
//security updates
|
||||
implementation 'ch.qos.logback:logback-classic:1.4.14'
|
||||
implementation 'ch.qos.logback:logback-core:1.4.14'
|
||||
implementation 'org.springframework:spring-webmvc:6.1.3'
|
||||
implementation 'org.springframework:spring-webmvc:6.1.4'
|
||||
|
||||
implementation("io.github.pixee:java-security-toolkit:1.1.2")
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.nio.file.Paths;
|
|||
import java.util.Collections;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
@ -17,7 +18,6 @@ import io.github.pixee.security.SystemCommand;
|
|||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import stirling.software.SPDF.config.ConfigInitializer;
|
||||
import stirling.software.SPDF.utils.GeneralUtils;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
|
@ -27,6 +27,13 @@ public class SPdfApplication {
|
|||
|
||||
@Autowired private Environment env;
|
||||
|
||||
private static String serverPortStatic;
|
||||
|
||||
@Value("${server.port:8080}")
|
||||
public void setServerPortStatic(String port) {
|
||||
SPdfApplication.serverPortStatic = port;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// Check if the BROWSER_OPEN environment variable is set to true
|
||||
|
@ -35,7 +42,7 @@ public class SPdfApplication {
|
|||
|
||||
if (browserOpen) {
|
||||
try {
|
||||
String url = "http://localhost:" + getPort();
|
||||
String url = "http://localhost:" + getNonStaticPort();
|
||||
|
||||
String os = System.getProperty("os.name").toLowerCase();
|
||||
Runtime rt = Runtime.getRuntime();
|
||||
|
@ -80,15 +87,15 @@ public class SPdfApplication {
|
|||
private static void printStartupLogs() {
|
||||
logger.info("Stirling-PDF Started.");
|
||||
|
||||
String url = "http://localhost:" + getPort();
|
||||
String url = "http://localhost:" + getStaticPort();
|
||||
logger.info("Navigate to {}", url);
|
||||
}
|
||||
|
||||
public static String getPort() {
|
||||
String port = System.getProperty("local.server.port");
|
||||
if (port == null || port.isEmpty()) {
|
||||
port = "8080";
|
||||
}
|
||||
return port;
|
||||
public static String getStaticPort() {
|
||||
return serverPortStatic;
|
||||
}
|
||||
|
||||
public String getNonStaticPort() {
|
||||
return serverPortStatic;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ApiDocService {
|
|||
|
||||
private String getApiDocsUrl() {
|
||||
String contextPath = servletContext.getContextPath();
|
||||
String port = SPdfApplication.getPort();
|
||||
String port = SPdfApplication.getStaticPort();
|
||||
|
||||
return "http://localhost:" + port + contextPath + "/v1/api-docs";
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class PipelineProcessor {
|
|||
|
||||
private String getBaseUrl() {
|
||||
String contextPath = servletContext.getContextPath();
|
||||
String port = SPdfApplication.getPort();
|
||||
String port = SPdfApplication.getStaticPort();
|
||||
|
||||
return "http://localhost:" + port + contextPath + "/";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user