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

View File

@ -120,19 +120,12 @@ Create the mongodb connection string.
{{- $port := 27017 -}}
{{- $user := "root" -}}
{{- $pass := "root" -}}
{{- if .Values.mongodbConnection -}}
{{- if .Values.mongodbConnection.host -}}
{{- $host = .Values.mongodbConnection.host -}}
{{- $connectionString := printf "mongodb://%s:%s@%s:%d/" $user $pass $host $port -}}
{{- if .Values.mongodbConnection.standardConnectionStringFormat -}}
{{- $connectionString = .Values.mongodbConnection.standardConnectionStringFormat -}}
{{- end -}}
{{- if .Values.mongodbConnection.port -}}
{{- $port = .Values.mongodbConnection.port -}}
{{- if .Values.mongodbConnection.dnsSeedListConnectionFormat -}}
{{- $connectionString = .Values.mongodbConnection.dnsSeedListConnectionFormat -}}
{{- end -}}
{{- if .Values.mongodbConnection.username -}}
{{- $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 -}}
{{- printf "%s" $connectionString -}}
{{- end -}}

View File

@ -43,19 +43,18 @@ mongodb:
service:
annotations: {}
# Recommended to replace with Mongo Cloud URI as the DB instance in the cluster does not have persistence yet
# By default the backend will be connected to a Mongo instance in the cluster.
# 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: {}
# host: mymongodb.com # defaults to the internal mongo service
# port: 27017
# username: root
# password: root
# standardConnectionStringFormat: <>
# dnsSeedListConnectionFormat: <>
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: "nginx"
hostName: example.com
hostName: example.com # replace with your domain
frontend:
path: /
pathType: Prefix
@ -98,7 +97,7 @@ backendEnvironmentVariables:
# Mail/SMTP
# Required to send emails
SMTP_HOST: MUST_REPLACE
SMTP_HOST: MUST_REPLACE
SMTP_NAME: MUST_REPLACE
SMTP_USERNAME: MUST_REPLACE
SMTP_PASSWORD: MUST_REPLACE