From 09e99edec461d2c09098e5edc48a041673da0474 Mon Sep 17 00:00:00 2001 From: Dmitry Shemin Date: Sun, 14 May 2023 10:05:36 +0700 Subject: [PATCH] feat: allow to specify connection url in secret --- dev/helm/templates/deployment.yaml | 8 ++++++++ dev/helm/values.yaml | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/dev/helm/templates/deployment.yaml b/dev/helm/templates/deployment.yaml index feebbe30..507fe1d8 100644 --- a/dev/helm/templates/deployment.yaml +++ b/dev/helm/templates/deployment.yaml @@ -50,6 +50,14 @@ spec: value: {{ .Values.externalPostgresql.databaseURL }} - name: NODE_TLS_REJECT_UNAUTHORIZED value: {{ default "1" .Values.externalPostgresql.NODE_TLS_REJECT_UNAUTHORIZED | quote }} + {{- else if and (.Values.externalPostgresql).existsSecret (.Values.externalPostgresql).existsSecretKeyName }} + - name: DATABASE_URL + valueFrom: + secretKeyRef: + name: {{ .Values.externalPostgresql.existsSecret }} + key: {{ .Values.externalPostgresql.existsSecretKeyName }} + - name: NODE_TLS_REJECT_UNAUTHORIZED + value: {{ default "1" .Values.externalPostgresql.NODE_TLS_REJECT_UNAUTHORIZED | quote }} {{- else }} - name: DB_HOST value: {{ template "wiki.postgresql.host" . }} diff --git a/dev/helm/values.yaml b/dev/helm/values.yaml index 2118debd..54340e9c 100644 --- a/dev/helm/values.yaml +++ b/dev/helm/values.yaml @@ -120,6 +120,11 @@ sideload: # externalPostgresql: # # note: ?sslmode=require => ?ssl=true # databaseURL: postgresql://postgres:postgres@postgres:5432/wiki?ssl=true +# # Exists secret which will be used for fetching database connection URL. +# existsSecret: wiki-database-secret +# # Used key in the secret. +# # Value in that key should be like in `externalPostgresql.databaseURL`. +# existsSecretKeyName: connection-url # # For self signed CAs, like DigitalOcean # NODE_TLS_REJECT_UNAUTHORIZED: "0"