Skip to content

Commit 271ab15

Browse files
authored
feat: allow using external mongodb
1 parent b9285dd commit 271ab15

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

deploy/helm/templates/api-service/secrets.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{{- $nameSpace := include "lowcoder.namespace" . -}}
2-
{{- $mongoUser := first .Values.mongodb.auth.usernames -}}
3-
{{- $mongoPassword := first .Values.mongodb.auth.passwords -}}
4-
{{- $mongoServicename := .Values.mongodb.service.nameOverride -}}
2+
{{- $mongoUser := (and .Values.mongodb.auth.usernames (first .Values.mongodb.auth.usernames)) | default "" -}}
3+
{{- $mongoPassword := (and .Values.mongodb.auth.passwords (first .Values.mongodb.auth.passwords)) | default "" -}}
54
{{- $lowcoderDatabase := first .Values.mongodb.auth.databases -}}
5+
{{- $mongoSecret := lookup "v1" "Secret" $nameSpace .Values.mongodb.auth.existingSecret | default dict -}}
6+
{{- $mongoSecretPassword := (index $mongoSecret.data "password" | default "" | b64dec) -}}
7+
{{- $mongoServicename := .Values.mongodb.service.nameOverride | default "" -}}
8+
{{- $externalUrl := .Values.mongodb.service.externalUrl -}}
9+
610
apiVersion: v1
711
kind: Secret
812
type: Opaque
@@ -18,7 +22,7 @@ stringData:
1822
{{- if .Values.mongodb.enabled }}
1923
LOWCODER_MONGODB_URL: "mongodb://{{ $mongoUser }}:{{ $mongoPassword }}@{{ $mongoServicename }}.{{ $nameSpace }}.svc.cluster.local/{{ $lowcoderDatabase }}?retryWrites=true&ssl=false"
2024
{{- else }}
21-
LOWCODER_MONGODB_URL: {{ .Values.mongodb.externalUrl | quote }}
25+
LOWCODER_MONGODB_URL: "mongodb://{{ $mongoUser }}:{{ $mongoSecretPassword }}@{{ $externalUrl }}/{{ $lowcoderDatabase }}?retryWrites=true&ssl=false"
2226
{{- end }}
2327
LOWCODER_DB_ENCRYPTION_PASSWORD: {{ .Values.global.config.encryption.password | default "lowcoder.org" | quote }}
2428
LOWCODER_DB_ENCRYPTION_SALT: {{ .Values.global.config.encryption.salt | default "lowcoder.org" | quote }}

0 commit comments

Comments
 (0)