From 0aa1b67d44c2204b5e3e2d9516bae2bc1766857d Mon Sep 17 00:00:00 2001
From: OZGCloud <ozgcloud@mgm-tp.com>
Date: Thu, 14 Nov 2024 15:17:08 +0100
Subject: [PATCH] OZG-6747 resovle comments

---
 src/main/helm/templates/_helpers.tpl    |  1 +
 src/main/helm/templates/deployment.yaml |  6 ++++--
 src/test/helm/deployment_env_test.yaml  | 19 +++++++++----------
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/main/helm/templates/_helpers.tpl b/src/main/helm/templates/_helpers.tpl
index f102cd8..c489662 100644
--- a/src/main/helm/templates/_helpers.tpl
+++ b/src/main/helm/templates/_helpers.tpl
@@ -39,6 +39,7 @@ component: antragraum-proxy
 {{- required "baseUrl muss angegeben sein" .Values.baseUrl }}
 {{- end -}}
 
+
 {{- define "app.getCustomList" -}}
 {{- with (.Values.env).customList -}}
 {{- if kindIs "map" . -}}
diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml
index f01228e..876433b 100644
--- a/src/main/helm/templates/deployment.yaml
+++ b/src/main/helm/templates/deployment.yaml
@@ -58,8 +58,10 @@ spec:
             app.kubernetes.io/name: {{ .Release.Name }}
       containers:
       - env:
-          - name: APP_ENV
-            value: "{{ .Values.appEnv | default "" }}"
+          {{- if (.Values.env).overrideGoProfiles }}
+          - name: ACTIVE_PROFILE
+            value: {{ (.Values.env).overrideGoProfiles }}
+          {{- end }}
           {{- with include "app.getCustomList" . }}
 {{ . | indent 10 }}
           {{- end }}
diff --git a/src/test/helm/deployment_env_test.yaml b/src/test/helm/deployment_env_test.yaml
index f02566e..3ccbb91 100644
--- a/src/test/helm/deployment_env_test.yaml
+++ b/src/test/helm/deployment_env_test.yaml
@@ -63,19 +63,18 @@ tests:
             name: test_environment
             value: "B test value"
 
-  - it: check envs default values
+  - it: should have env ACTIVE_PROFILE with correct value when set
+    set:
+      env.overrideGoProfiles: oc,test,ea
     asserts:
       - contains:
           path: spec.template.spec.containers[0].env
           content:
-            name: APP_ENV
-            value: ""
-  - it: should set APP_ENV
-    set:
-      appEnv: prod
+            name: ACTIVE_PROFILE
+            value: oc,test,ea
+            
+  - it: should by default not have the ACTIVE_PROFILE env
     asserts:
-      - contains:
+      - equal:
           path: spec.template.spec.containers[0].env
-          content:
-            name: APP_ENV
-            value: "prod"
\ No newline at end of file
+          value: null
\ No newline at end of file
-- 
GitLab