Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Allow mongo connection string based on type

Maidul Islam375412b45d0b
diff --git a/helm-charts/infisical/templates/_helpers.tpl b/helm-charts/infisical/templates/_helpers.tpl
index 2f2bf2a3ab..32bc9b02bf 100644
--- a/helm-charts/infisical/templates/_helpers.tpl
+++ b/helm-charts/infisical/templates/_helpers.tpl
@@ -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 -}}
diff --git a/helm-charts/infisical/values.yaml b/helm-charts/infisical/values.yaml
index 0425065d22..13df7b966a 100644
--- a/helm-charts/infisical/values.yaml
+++ b/helm-charts/infisical/values.yaml
@@ -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