Skip to content

Commit

Permalink
feat: allow using external mongodb
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo authored Jun 29, 2024
1 parent b9285dd commit 271ab15
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions deploy/helm/templates/api-service/secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{{- $nameSpace := include "lowcoder.namespace" . -}}
{{- $mongoUser := first .Values.mongodb.auth.usernames -}}
{{- $mongoPassword := first .Values.mongodb.auth.passwords -}}
{{- $mongoServicename := .Values.mongodb.service.nameOverride -}}
{{- $mongoUser := (and .Values.mongodb.auth.usernames (first .Values.mongodb.auth.usernames)) | default "" -}}
{{- $mongoPassword := (and .Values.mongodb.auth.passwords (first .Values.mongodb.auth.passwords)) | default "" -}}
{{- $lowcoderDatabase := first .Values.mongodb.auth.databases -}}
{{- $mongoSecret := lookup "v1" "Secret" $nameSpace .Values.mongodb.auth.existingSecret | default dict -}}
{{- $mongoSecretPassword := (index $mongoSecret.data "password" | default "" | b64dec) -}}
{{- $mongoServicename := .Values.mongodb.service.nameOverride | default "" -}}
{{- $externalUrl := .Values.mongodb.service.externalUrl -}}

apiVersion: v1
kind: Secret
type: Opaque
Expand All @@ -18,7 +22,7 @@ stringData:
{{- if .Values.mongodb.enabled }}
LOWCODER_MONGODB_URL: "mongodb://{{ $mongoUser }}:{{ $mongoPassword }}@{{ $mongoServicename }}.{{ $nameSpace }}.svc.cluster.local/{{ $lowcoderDatabase }}?retryWrites=true&ssl=false"
{{- else }}
LOWCODER_MONGODB_URL: {{ .Values.mongodb.externalUrl | quote }}
LOWCODER_MONGODB_URL: "mongodb://{{ $mongoUser }}:{{ $mongoSecretPassword }}@{{ $externalUrl }}/{{ $lowcoderDatabase }}?retryWrites=true&ssl=false"
{{- end }}
LOWCODER_DB_ENCRYPTION_PASSWORD: {{ .Values.global.config.encryption.password | default "lowcoder.org" | quote }}
LOWCODER_DB_ENCRYPTION_SALT: {{ .Values.global.config.encryption.salt | default "lowcoder.org" | quote }}
Expand Down

0 comments on commit 271ab15

Please sign in to comment.