From 309ea0663efa563ec27dede8ba80096be3ff807e Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Mon, 24 Apr 2023 22:47:22 +0200
Subject: [PATCH] fix(hedgedoc): Adjust for broken booleans

This patch reworks parts of the helm chart, to always include boolean
values with their default instead of using a `with` clause. Since the
`with` clause works like an `if`, it would not explicitly decleare a
`false` value due to evaluating to false and therefore not being
considered for content evaluation.
---
 charts/hedgedoc/Chart.yaml                    |  2 +-
 charts/hedgedoc/README.md                     |  2 +-
 charts/hedgedoc/templates/configmap.yaml      | 24 +++++--------------
 charts/hedgedoc/templates/secret.yaml         |  2 +-
 .../__snapshot__/98_snapshot_test.yaml.snap   |  4 ++++
 5 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/charts/hedgedoc/Chart.yaml b/charts/hedgedoc/Chart.yaml
index 715896ac6..83daee6f7 100644
--- a/charts/hedgedoc/Chart.yaml
+++ b/charts/hedgedoc/Chart.yaml
@@ -14,7 +14,7 @@ keywords:
 sources:
     - https://github.com/hedgedoc/hedgedoc/tree/master
     - https://git.shivering-isles.com/shivering-isles/infrastructure-gitops/-/tree/main/charts/hedgedoc
-version: 0.2.2
+version: 0.2.3
 # renovate: image=quay.io/hedgedoc/hedgedoc
 appVersion: 1.9.7
 maintainers:
diff --git a/charts/hedgedoc/README.md b/charts/hedgedoc/README.md
index e81792c13..8beee62c8 100644
--- a/charts/hedgedoc/README.md
+++ b/charts/hedgedoc/README.md
@@ -1,6 +1,6 @@
 # hedgedoc
 
-![Version: 0.2.2](https://img.shields.io/badge/Version-0.2.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.9.7](https://img.shields.io/badge/AppVersion-1.9.7-informational?style=flat-square)
+![Version: 0.2.3](https://img.shields.io/badge/Version-0.2.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.9.7](https://img.shields.io/badge/AppVersion-1.9.7-informational?style=flat-square)
 
 A platform to write and share markdown.
 
diff --git a/charts/hedgedoc/templates/configmap.yaml b/charts/hedgedoc/templates/configmap.yaml
index 3191f8b1d..4dfc1f973 100644
--- a/charts/hedgedoc/templates/configmap.yaml
+++ b/charts/hedgedoc/templates/configmap.yaml
@@ -18,9 +18,7 @@ data:
   {{- with .Values.config.session.lifeTime }}
   CMD_SESSION_LIFE: {{ . | quote }}
   {{- end }}
-  {{- with .Values.config.allowFreeUrl }}
-  CMD_ALLOW_FREE_URL: {{ . | quote }}
-  {{- end }}
+  CMD_ALLOW_FREE_URL: {{ .Values.config.allowFreeUrl | quote }}
   {{- if .Values.ingress.enabled }}
   CMD_DOMAIN: {{ (index .Values.ingress.hosts 0).host | quote }}
   {{- else }}
@@ -28,18 +26,10 @@ data:
   CMD_DOMAIN: {{ . | quote }}
   {{- end }}
   {{- end }}
-  {{- with .Values.config.email }}
-  CMD_EMAIL: {{ . | quote }}
-  {{- end }}
-  {{- with .Values.config.protocolUseSsl }}
-  CMD_PROTOCOL_USESSL: {{ . | quote }}
-  {{- end }}
-  {{- with .Values.config.urlAddPort }}
-  CMD_URL_ADDPORT: {{ . | quote }}
-  {{- end }}
-  {{- with .Values.config.useCdn }}
-  CMD_USECDN: {{ . | quote }}
-  {{- end }}
+  CMD_EMAIL: {{ .Values.config.email | quote }}
+  CMD_PROTOCOL_USESSL: {{ .Values.config.protocolUseSsl | quote }}
+  CMD_URL_ADDPORT: {{ .Values.config.urlAddPort | quote }}
+  CMD_USECDN: {{ .Values.config.useCdn | quote }}
   CMD_IMAGE_UPLOAD_TYPE: minio
   {{- with .Values.config.minio.endpoint }}
   CMD_MINIO_ENDPOINT: {{ . | quote }}
@@ -47,9 +37,7 @@ data:
   {{- with .Values.config.minio.port }}
   CMD_MINIO_PORT: {{ . | quote }}
   {{- end }}
-  {{- with .Values.config.minio.secure }}
-  CMD_MINIO_SECURE: {{ . | quote }}
-  {{- end }}
+  CMD_MINIO_SECURE: {{ .Values.config.minio.secure | quote }}
   {{- with .Values.config.s3bucket }}
   CMD_S3_BUCKET: {{ . | quote }}
   {{- end }}
diff --git a/charts/hedgedoc/templates/secret.yaml b/charts/hedgedoc/templates/secret.yaml
index a3c53d8f4..b684394c4 100644
--- a/charts/hedgedoc/templates/secret.yaml
+++ b/charts/hedgedoc/templates/secret.yaml
@@ -26,6 +26,6 @@ data:
   {{- end }}
   {{- if not .Values.postgresql.enabled }}
   {{- if not .Values.postgresql.auth.existingSecret }}
-  CMD_DB_PASSWORD: "{{ .Values.postgresql.auth.password | b64enc }}"
+  CMD_DB_PASSWORD: {{ .Values.postgresql.auth.password | b64enc }}
   {{- end }}
   {{- end }}
\ No newline at end of file
diff --git a/charts/hedgedoc/tests/__snapshot__/98_snapshot_test.yaml.snap b/charts/hedgedoc/tests/__snapshot__/98_snapshot_test.yaml.snap
index a594c0be2..4e7ad6368 100644
--- a/charts/hedgedoc/tests/__snapshot__/98_snapshot_test.yaml.snap
+++ b/charts/hedgedoc/tests/__snapshot__/98_snapshot_test.yaml.snap
@@ -2,6 +2,7 @@ should match basic snapshot:
   1: |
     apiVersion: v1
     data:
+      CMD_ALLOW_FREE_URL: "false"
       CMD_DB_DATABASE: hedgedoc
       CMD_DB_DIALECT: postgres
       CMD_DB_HOST: RELEASE-NAME-postgresql
@@ -9,6 +10,7 @@ should match basic snapshot:
       CMD_DB_USERNAME: hedgedoc
       CMD_DEFAULT_PERMISSION: freely
       CMD_DOMAIN: hedgedoc.example.com
+      CMD_EMAIL: "false"
       CMD_IMAGE_UPLOAD_TYPE: minio
       CMD_MINIO_PORT: "443"
       CMD_MINIO_SECURE: "true"
@@ -19,6 +21,8 @@ should match basic snapshot:
       CMD_PROTOCOL_USESSL: "true"
       CMD_S3_BUCKET: hedgedoc
       CMD_SESSION_LIFE: "3.6e+07"
+      CMD_URL_ADDPORT: "false"
+      CMD_USECDN: "false"
     kind: ConfigMap
     metadata:
       labels:
-- 
GitLab