Add SHOW_SURVEY Environment variable to Docker, to disable survey in local Docker installation

This commit is contained in:
Muratcan Yeldan 2025-04-18 08:28:44 +03:00
parent 49e3706a30
commit af1e9778f0
12 changed files with 19 additions and 1 deletions

View File

@ -153,6 +153,7 @@ services:
SYSTEM_MAXFILESIZE: "100"
METRICS_ENABLED: "true"
SYSTEM_GOOGLEVISIBILITY: "true"
SHOW_SURVEY: "true"
restart: on-failure:5
```

View File

@ -32,4 +32,5 @@ services:
SYSTEM_MAXFILESIZE: "100"
METRICS_ENABLED: "true"
SYSTEM_GOOGLEVISIBILITY: "true"
SHOW_SURVEY: "true"
restart: on-failure:5

View File

@ -36,6 +36,7 @@ services:
SYSTEM_DATASOURCE_CUSTOMDATABASEURL: "jdbc:postgresql://db:5432/stirling_pdf"
SYSTEM_DATASOURCE_USERNAME: "admin"
SYSTEM_DATASOURCE_PASSWORD: "stirling"
SHOW_SURVEY: "true"
restart: on-failure:5
db:

View File

@ -30,4 +30,5 @@ services:
SYSTEM_MAXFILESIZE: "100"
METRICS_ENABLED: "true"
SYSTEM_GOOGLEVISIBILITY: "true"
SHOW_SURVEY: "true"
restart: on-failure:5

View File

@ -38,4 +38,5 @@ services:
SYSTEM_MAXFILESIZE: "100"
METRICS_ENABLED: "true"
SYSTEM_GOOGLEVISIBILITY: "true"
SHOW_SURVEY: "true"
restart: on-failure:5

View File

@ -30,4 +30,5 @@ services:
SYSTEM_MAXFILESIZE: "100"
METRICS_ENABLED: "true"
SYSTEM_GOOGLEVISIBILITY: "true"
SHOW_SURVEY: "true"
restart: on-failure:5

View File

@ -27,4 +27,5 @@ services:
SYSTEM_MAXFILESIZE: "100"
METRICS_ENABLED: "true"
SYSTEM_GOOGLEVISIBILITY: "true"
SHOW_SURVEY: "true"
restart: on-failure:5

View File

@ -26,4 +26,5 @@ services:
SYSTEM_MAXFILESIZE: "100"
METRICS_ENABLED: "true"
SYSTEM_GOOGLEVISIBILITY: "true"
SHOW_SURVEY: "true"
restart: on-failure:5

View File

@ -28,4 +28,5 @@ services:
SYSTEM_MAXFILESIZE: "100"
METRICS_ENABLED: "true"
SYSTEM_GOOGLEVISIBILITY: "true"
SHOW_SURVEY: "true"
restart: on-failure:5

View File

@ -67,6 +67,9 @@ public class HomeWebController {
@GetMapping("/")
public String home(Model model) {
model.addAttribute("currentPage", "home");
String showSurvey = System.getenv("SHOW_SURVEY");
boolean showSurveyValue = showSurvey == null || "true".equalsIgnoreCase(showSurvey);
model.addAttribute("showSurveyFromDocker", showSurveyValue);
return "home";
}

View File

@ -61,6 +61,10 @@ document.addEventListener('DOMContentLoaded', function () {
localStorage.setItem('pageViews', pageViews.toString());
function shouldShowSurvey() {
if(!window.showSurvey) {
return false;
}
if (localStorage.getItem('dontShowSurvey') === 'true' || localStorage.getItem('surveyTaken') === 'true') {
return false;
}
@ -112,7 +116,7 @@ function setAsDefault(value) {
function adjustVisibleElements() {
const container = document.querySelector('.recent-features');
if(!container) return;
if(!container) return;
const subElements = Array.from(container.children);
let totalWidth = 0;

View File

@ -218,6 +218,8 @@
/*<![CDATA[*/
window.analyticsPromptBoolean = /*[[${@analyticsPrompt}]]*/ false;
/*]]>*/
window.showSurvey = /*[[${showSurveyFromDocker}]]*/ true
</script>
<script th:src="@{'/js/pages/home.js'}" th:inline="javascript"></script>