Skip to content

Commit 1734118

Browse files
AlexeyPetroffludomikula
authored andcommitted
Allow mongodb SSL and srv configs
1 parent c7a425e commit 1734118

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{{- $nameSpace := include "lowcoder.namespace" . -}}
22
{{- $mongoUser := (and .Values.mongodb.auth.usernames (first .Values.mongodb.auth.usernames)) | default "" -}}
33
{{- $mongoPassword := (and .Values.mongodb.auth.passwords (first .Values.mongodb.auth.passwords)) | default "" -}}
4+
{{- $mongoProtocol := ternary "mongodb+srv" "mongodb" .Values.mongodb.useSrv -}}
5+
{{- $mongoSSL := ternary "true" "false" .Values.mongodb.useSSL -}}
46
{{- $lowcoderDatabase := first .Values.mongodb.auth.databases -}}
57
{{- $mongoSecret := lookup "v1" "Secret" $nameSpace .Values.mongodb.auth.existingSecret | default dict -}}
68
{{- $mongoSecretPassword := (index ($mongoSecret.data | default dict) "password" | default "" | b64dec) -}}
@@ -20,9 +22,9 @@ metadata:
2022
{{- end }}
2123
stringData:
2224
{{- if .Values.mongodb.enabled }}
23-
LOWCODER_MONGODB_URL: "mongodb://{{ $mongoUser }}:{{ $mongoPassword }}@{{ $mongoServicename }}.{{ $nameSpace }}.svc.cluster.local/{{ $lowcoderDatabase }}?retryWrites=true&ssl=false"
25+
LOWCODER_MONGODB_URL: "{{ $mongoProtocol }}://{{ $mongoUser }}:{{ $mongoPassword }}@{{ $mongoServicename }}.{{ $nameSpace }}.svc.cluster.local/{{ $lowcoderDatabase }}?retryWrites=true&ssl=false"
2426
{{- else }}
25-
LOWCODER_MONGODB_URL: "mongodb://{{ $mongoUser }}:{{ $mongoSecretPassword }}@{{ $externalUrl }}/{{ $lowcoderDatabase }}?retryWrites=true&ssl=false"
27+
LOWCODER_MONGODB_URL: "{{ $mongoProtocol }}://{{ $mongoUser }}:{{ $mongoSecretPassword }}@{{ $externalUrl }}/{{ $lowcoderDatabase }}?retryWrites=true&ssl={{ $mongoSSL }}"
2628
{{- end }}
2729
LOWCODER_DB_ENCRYPTION_PASSWORD: {{ .Values.global.config.encryption.password | default "lowcoder.org" | quote }}
2830
LOWCODER_DB_ENCRYPTION_SALT: {{ .Values.global.config.encryption.salt | default "lowcoder.org" | quote }}

deploy/helm/values.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,14 @@ redis:
6363
# Find out more about configuration options at: https://github.com/bitnami/charts/tree/main/bitnami/mongodb/#parameters
6464
#
6565
mongodb:
66-
#externalUrl:
6766
enabled: true
6867
service:
6968
nameOverride: lowcoder-mongodb
69+
#externalUrl:
70+
# if set to true, will use mongodb+srv:// as a prefix in mongo connection string
71+
useSrv: false
72+
# if set to true, will use SSL in mongo connection string; Only considered if using external mongodb
73+
useSSL: false
7074
auth:
7175
rootUser: root
7276
rootPassword: secret

0 commit comments

Comments
 (0)