diff --git a/Dockerfile b/Dockerfile index 880d89bd..06212d2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,7 +50,9 @@ COPY build/libs/*.jar app.jar EXPOSE 8080 # Set environment variables -ENV APP_NAME="Stirling PDF" +ENV APP_HOME_NAME="Stirling PDF" +#ENV APP_HOME_DESCRIPTION="Personal PDF Website!" +#ENV APP_NAVBAR_NAME="Stirling PDF" # Run the application ENTRYPOINT java -jar /app.jar diff --git a/README.md b/README.md index 6e6f206b..cc5a4bdf 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ services: image: frooodle/s-pdf ``` + ## Enable OCR/Compression feature Please view https://github.com/Frooodle/Stirling-PDF/blob/main/HowToUseOCR.md @@ -90,3 +91,7 @@ Also please note as i add new features i will google translate existing language 2. Use the application by following the instructions on the website. +## Customize App Name +Stirling PDF allows easy customization of the visible application name. +Simply use environment variables APP_HOME_NAME, APP_HOME_DESCRIPTION and APP_NAVBAR_NAME with Docker or Java. +If running Java directly, you can also pass these as properties using -D arguments. \ No newline at end of file diff --git a/src/main/java/stirling/software/SPDF/config/AppConfig.java b/src/main/java/stirling/software/SPDF/config/AppConfig.java index 431148d8..3b551cea 100644 --- a/src/main/java/stirling/software/SPDF/config/AppConfig.java +++ b/src/main/java/stirling/software/SPDF/config/AppConfig.java @@ -14,9 +14,30 @@ public class AppConfig { @Bean(name = "appName") public String appName() { - String appName = System.getProperty("AppName"); + String appName = System.getProperty("APP_HOME_NAME"); if(appName == null) - appName = System.getenv("APP_NAME"); + appName = System.getenv("APP_HOME_NAME"); return (appName != null) ? appName : "Stirling PDF"; } + + @Bean(name = "navBarText") + public String navBarText() { + String navBarText = System.getProperty("APP_NAVBAR_NAME"); + if(navBarText == null) + navBarText = System.getenv("APP_NAVBAR_NAME"); + if(navBarText == null) + navBarText = System.getProperty("APP_HOME_NAME"); + if(navBarText == null) + navBarText = System.getenv("APP_HOME_NAME"); + + return (navBarText != null) ? navBarText : "Stirling PDF"; + } + + @Bean(name = "homeText") + public String homeText() { + String homeText = System.getProperty("APP_HOME_DESCRIPTION"); + if(homeText == null) + homeText = System.getenv("APP_HOME_DESCRIPTION"); + return (homeText != null) ? homeText : "null"; + } } \ No newline at end of file diff --git a/src/main/resources/templates/add-image.html b/src/main/resources/templates/add-image.html index f6b67e5f..8efc965b 100644 --- a/src/main/resources/templates/add-image.html +++ b/src/main/resources/templates/add-image.html @@ -26,7 +26,7 @@