Allow mongo connection string based on type

This commit is contained in:
Maidul Islam
2023-01-17 22:34:19 -08:00
parent fd2966610c
commit 375412b45d
2 changed files with 13 additions and 21 deletions
+6 -13
View File
@@ -120,19 +120,12 @@ Create the mongodb connection string.
{{- $port := 27017 -}} {{- $port := 27017 -}}
{{- $user := "root" -}} {{- $user := "root" -}}
{{- $pass := "root" -}} {{- $pass := "root" -}}
{{- if .Values.mongodbConnection -}} {{- $connectionString := printf "mongodb://%s:%s@%s:%d/" $user $pass $host $port -}}
{{- if .Values.mongodbConnection.host -}} {{- if .Values.mongodbConnection.standardConnectionStringFormat -}}
{{- $host = .Values.mongodbConnection.host -}} {{- $connectionString = .Values.mongodbConnection.standardConnectionStringFormat -}}
{{- end -}} {{- end -}}
{{- if .Values.mongodbConnection.port -}} {{- if .Values.mongodbConnection.dnsSeedListConnectionFormat -}}
{{- $port = .Values.mongodbConnection.port -}} {{- $connectionString = .Values.mongodbConnection.dnsSeedListConnectionFormat -}}
{{- end -}} {{- end -}}
{{- if .Values.mongodbConnection.username -}} {{- printf "%s" $connectionString -}}
{{- $user = .Values.mongodbConnection.username -}}
{{- end -}}
{{- if .Values.mongodbConnection.password -}}
{{- $pass = .Values.mongodbConnection.password -}}
{{- end -}}
{{- end -}}
{{- printf "mongodb://%s:%s@%s:%d/" $user $pass $host $port -}}
{{- end -}} {{- end -}}
+7 -8
View File
@@ -43,19 +43,18 @@ mongodb:
service: service:
annotations: {} annotations: {}
# By default the backend will be connected to a Mongo instance in the cluster.
# Recommended to replace with Mongo Cloud URI as the DB instance in the cluster does not have persistence yet # However, it is recommended to add a Mongo Cloud connection string as the DB instance in the cluster does not have persistence yet.
# Learn about connection string type here https://www.mongodb.com/docs/manual/reference/connection-string/
mongodbConnection: {} mongodbConnection: {}
# host: mymongodb.com # defaults to the internal mongo service # standardConnectionStringFormat: <>
# port: 27017 # dnsSeedListConnectionFormat: <>
# username: root
# password: root
ingress: ingress:
enabled: true enabled: true
annotations: annotations:
kubernetes.io/ingress.class: "nginx" kubernetes.io/ingress.class: "nginx"
hostName: example.com hostName: example.com # replace with your domain
frontend: frontend:
path: / path: /
pathType: Prefix pathType: Prefix
@@ -98,7 +97,7 @@ backendEnvironmentVariables:
# Mail/SMTP # Mail/SMTP
# Required to send emails # Required to send emails
SMTP_HOST: MUST_REPLACE SMTP_HOST: MUST_REPLACE
SMTP_NAME: MUST_REPLACE SMTP_NAME: MUST_REPLACE
SMTP_USERNAME: MUST_REPLACE SMTP_USERNAME: MUST_REPLACE
SMTP_PASSWORD: MUST_REPLACE SMTP_PASSWORD: MUST_REPLACE