From 22be1a1104810d13e4525e4ed1d1215ce7966043 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sun, 2 Apr 2023 11:51:07 +0100 Subject: [PATCH] envs --- Dockerfile | 4 ++- README.md | 5 ++++ .../software/SPDF/config/AppConfig.java | 25 +++++++++++++++++-- src/main/resources/templates/add-image.html | 2 +- .../resources/templates/compress-pdf.html | 2 +- .../templates/convert/file-to-pdf.html | 2 +- .../templates/convert/img-to-pdf.html | 2 +- .../templates/convert/pdf-to-img.html | 2 +- .../templates/convert/pdf-to-pdfa.html | 2 +- .../resources/templates/extract-images.html | 2 +- .../resources/templates/fragments/common.html | 11 +++++++- .../resources/templates/fragments/navbar.html | 2 +- src/main/resources/templates/home.html | 2 +- src/main/resources/templates/merge-pdfs.html | 2 +- src/main/resources/templates/ocr-pdf.html | 2 +- .../resources/templates/pdf-organizer.html | 2 +- .../resources/templates/remove-pages.html | 2 +- src/main/resources/templates/rotate-pdf.html | 2 +- .../templates/security/add-password.html | 2 +- .../templates/security/add-watermark.html | 2 +- .../templates/security/change-metadata.html | 2 +- .../security/change-permissions.html | 2 +- .../templates/security/remove-password.html | 2 +- .../templates/security/remove-watermark.html | 2 +- src/main/resources/templates/split-pdfs.html | 2 +- 25 files changed, 62 insertions(+), 25 deletions(-) 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 @@
- + diff --git a/src/main/resources/templates/compress-pdf.html b/src/main/resources/templates/compress-pdf.html index 64e1c6e8..0636810a 100644 --- a/src/main/resources/templates/compress-pdf.html +++ b/src/main/resources/templates/compress-pdf.html @@ -33,7 +33,7 @@ - +

diff --git a/src/main/resources/templates/convert/file-to-pdf.html b/src/main/resources/templates/convert/file-to-pdf.html index d20f3fa4..dca2a21c 100644 --- a/src/main/resources/templates/convert/file-to-pdf.html +++ b/src/main/resources/templates/convert/file-to-pdf.html @@ -17,7 +17,7 @@

- +

diff --git a/src/main/resources/templates/convert/img-to-pdf.html b/src/main/resources/templates/convert/img-to-pdf.html index fcfa5717..8f8a0662 100644 --- a/src/main/resources/templates/convert/img-to-pdf.html +++ b/src/main/resources/templates/convert/img-to-pdf.html @@ -39,7 +39,7 @@

- +