1
0
mirror of https://github.com/Stirling-Tools/Stirling-PDF.git synced 2024-06-03 06:10:11 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
dependabot[bot]
aa13e10a26
Merge 28e0be145d into 146b8f0103 2024-02-25 22:26:06 -08:00
Ludy
146b8f0103
Corrected the reading of the port. See: #834 (#855)
* Corrected the reading of the port. See: #834

* Removed outdated import

---------

Co-authored-by: Eric <71648843+sbplat@users.noreply.github.com>
2024-02-25 19:15:03 -05:00
dependabot[bot]
28e0be145d
Bump org.springframework:spring-webmvc from 6.1.3 to 6.1.4
Bumps [org.springframework:spring-webmvc](https://github.com/spring-projects/spring-framework) from 6.1.3 to 6.1.4.
- [Release notes](https://github.com/spring-projects/spring-framework/releases)
- [Commits](https://github.com/spring-projects/spring-framework/compare/v6.1.3...v6.1.4)

---
updated-dependencies:
- dependency-name: org.springframework:spring-webmvc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-19 22:59:12 +00:00
4 changed files with 19 additions and 12 deletions

View File

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

View File

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

View File

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

View File

@ -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 + "/";
}