From c8492da4524c80990f3ca213fdb7a3d0c28e3eca Mon Sep 17 00:00:00 2001
From: Diego Lagos <92735530+diegolagospagopa@users.noreply.github.com>
Date: Mon, 22 May 2023 11:36:37 +0200
Subject: [PATCH] feat: Removed mandatory variables (#34)

* removed mandatory variables

* another commit
---
 Dockerfile                                               | 3 ---
 README.md                                                | 8 +-------
 docker-compose.yaml                                      | 2 --
 .../pagopa/devops/springbootshowcase/RootController.java | 8 --------
 src/main/resources/templates/indexTemplate.html          | 9 ---------
 5 files changed, 1 insertion(+), 29 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index f289555..8e6c398 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,9 +3,6 @@
 #
 FROM maven:3.8.4-jdk-11-slim as buildtime
 
-ENV MY_MANDATORY_SECRET=dummy \
-    MY_MANDATORY_VALUE=dummy
-
 WORKDIR /build
 COPY . .
 
diff --git a/README.md b/README.md
index 938bafa..131c25d 100644
--- a/README.md
+++ b/README.md
@@ -29,18 +29,12 @@ Has liveness and readiness endpoints for k8s
 
 You can use this simple application or locally or with docker compose, or with k8s usign the helm chart.
 
-> Is mandatory to setup this two env variables:
-> * MY_MANDATORY_VALUE
-> * MY_MANDATORY_SECRET
-
-This variables are for asserts of helm template
-
 ### Locally
 
 Run the application usign this command
 
 ```sh
-export MY_APP_COLOR=green MY_MANDATORY_VALUE=dummy MY_MANDATORY_SECRET=dummy && mvn spring-boot:run
+export MY_APP_COLOR=green && mvn spring-boot:run
 ```
 
 In this way you are able to set a color as env variable and run a spring boot server (with tomcat)
diff --git a/docker-compose.yaml b/docker-compose.yaml
index b351ff5..fc8e36e 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -9,7 +9,5 @@ services:
     restart: always
     environment:
       - MY_APP_COLOR=red
-      - MY_MANDATORY_SECRET="very secret"
-      - MY_MANDATORY_VALUE="very value"
     ports:
       - "8080:8080"
diff --git a/src/main/java/it/pagopa/devops/springbootshowcase/RootController.java b/src/main/java/it/pagopa/devops/springbootshowcase/RootController.java
index ce8d465..d51813c 100644
--- a/src/main/java/it/pagopa/devops/springbootshowcase/RootController.java
+++ b/src/main/java/it/pagopa/devops/springbootshowcase/RootController.java
@@ -22,12 +22,6 @@ public class RootController {
     @Value("${MY_APP_COLOR:}")
     private String myAppColor;
 
-    @Value("${MY_MANDATORY_SECRET}")
-    private String myMandatorySecret;
-
-    @Value("${MY_MANDATORY_VALUE}")
-    private String myMandatoryValue;
-
     @GetMapping("/")
     public ModelAndView passParametersWithModelAndView() throws UnknownHostException {
 
@@ -35,8 +29,6 @@ public ModelAndView passParametersWithModelAndView() throws UnknownHostException
         modelAndView.addObject("color", getOneColor(myAppColor, colors));
         modelAndView.addObject("hostname", InetAddress.getLocalHost().getHostName());
         modelAndView.addObject("envs", envs());
-        modelAndView.addObject("myMandatorySecret", myMandatorySecret);
-        modelAndView.addObject("myMandatoryValue", myMandatoryValue);
         return modelAndView;
     }
 
diff --git a/src/main/resources/templates/indexTemplate.html b/src/main/resources/templates/indexTemplate.html
index bfe36b0..0fad4ab 100644
--- a/src/main/resources/templates/indexTemplate.html
+++ b/src/main/resources/templates/indexTemplate.html
@@ -12,15 +12,6 @@
       <div th:text="${hostname}">hostname</div>
     </div>
     <br/>
-    <div style="font-size: 1em; display: inline-flex;">
-      <div>myMandatorySecret: </div>
-      <div th:text="${myMandatorySecret}">myMandatorySecret</div>
-    </div>
-    <br/>
-    <div style="font-size: 1em; display: inline-flex;">
-      <div>myMandatoryValue: </div>
-      <div th:text="${myMandatoryValue}">myMandatoryValue</div>
-    </div>
   </div>
   
   <br/>