@@ -64,11 +64,7 @@ Create image name that is used in the deployment
6464{{/*
6565Create environment variables used to configure the nextcloud container as well as the cron sidecar container.
6666*/ }}
67- {{- define " nextcloud.env" -}}
68- {{- if .Values.phpClientHttpsFix.enabled }}
69- - name: OVERWRITEPROTOCOL
70- value: {{ .Values.phpClientHttpsFix.protocol | quote }}
71- {{- end }}
67+ {{- define " nextcloud.env.database" -}}
7268{{- if .Values.internalDatabase.enabled }}
7369- name: SQLITE_DATABASE
7470 value: {{ .Values.internalDatabase.name | quote }}
@@ -87,6 +83,8 @@ Create environment variables used to configure the nextcloud container as well a
8783 secretKeyRef:
8884 name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf " %s -db" .Release.Name ) }}
8985 key: {{ .Values.externalDatabase.existingSecret.passwordKey }}
86+ - name: DATABASE_URL
87+ value: " mysql://$(MYSQL_USER):$(MYSQL_PASSWORD)@$(MYSQL_HOST)/$(MYSQL_DATABASE)"
9088{{- else if .Values.postgresql.enabled }}
9189- name: POSTGRES_HOST
9290 value: {{ template " postgresql.v1.primary.fullname" .Subcharts.postgresql }}
@@ -106,7 +104,9 @@ Create environment variables used to configure the nextcloud container as well a
106104 secretKeyRef:
107105 name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf " %s -db" .Release.Name ) }}
108106 key: {{ .Values.externalDatabase.existingSecret.passwordKey }}
109- {{- else }}
107+ - name: DATABASE_URL
108+ value: " postgres://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@$(POSTGRES_HOST)/$(POSTGRES_DB)"
109+ {{- else }}{{/* mariadb.enable or postgresql.enabled -> now external */ }}
110110 {{- if eq .Values.externalDatabase.type " postgresql" }}
111111- name: POSTGRES_HOST
112112 {{- if .Values.externalDatabase.existingSecret.hostKey }}
@@ -136,7 +136,9 @@ Create environment variables used to configure the nextcloud container as well a
136136 secretKeyRef:
137137 name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf " %s -db" .Release.Name ) }}
138138 key: {{ .Values.externalDatabase.existingSecret.passwordKey }}
139- {{- else }}
139+ - name: DATABASE_URL
140+ value: " postgres://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@$(POSTGRES_HOST)/$(POSTGRES_DB)"
141+ {{- else }}{{/* external.type = postgresql */ }}
140142- name: MYSQL_HOST
141143 {{- if .Values.externalDatabase.existingSecret.hostKey }}
142144 valueFrom:
@@ -165,8 +167,72 @@ Create environment variables used to configure the nextcloud container as well a
165167 secretKeyRef:
166168 name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf " %s -db" .Release.Name ) }}
167169 key: {{ .Values.externalDatabase.existingSecret.passwordKey }}
168- {{- end }}
170+ - name: DATABASE_URL
171+ value: " mysql://$(MYSQL_USER):$(MYSQL_PASSWORD)@$(MYSQL_HOST)/$(MYSQL_DATABASE)"
172+ {{- end }}{{/* external.type = postgresql */ }}
173+ {{- end }}{{/* not mariadb.enable or postgresql.enabled -> just external*/ }}
174+ {{- end }}
175+
176+ {{/*
177+ Redis env vars
178+ */ }}
179+ {{- define " nextcloud.env.redis" -}}
180+ {{- if .Values.redis.enabled }}
181+ - name: REDIS_HOST
182+ value: {{ template " nextcloud.redis.fullname" . }}-master
183+ - name: REDIS_HOST_PORT
184+ value: {{ .Values.redis.master.service.ports.redis | quote }}
185+ {{- if .Values.redis.auth.enabled }}
186+ {{- if and .Values.redis.auth.existingSecret .Values.redis.auth.existingSecretPasswordKey }}
187+ - name: REDIS_HOST_PASSWORD
188+ valueFrom:
189+ secretKeyRef:
190+ name: {{ .Values.redis.auth.existingSecret }}
191+ key: {{ .Values.redis.auth.existingSecretPasswordKey }}
192+ {{- else }}
193+ - name: REDIS_HOST_PASSWORD
194+ value: {{ .Values.redis.auth.password }}
195+ {{- end }}
196+ {{- end }}
197+ {{- else if .Values.externalRedis.enabled }}
198+ - name: REDIS_HOST
199+ value: {{ .Values.externalRedis.host | quote }}
200+ - name: REDIS_HOST_PORT
201+ value: {{ .Values.externalRedis.port | quote }}
202+ {{- if .Values.externalRedis.existingSecret.enabled }}
203+ {{- if and .Values.externalRedis.existingSecret.secretName .Values.externalRedis.existingSecret.passwordKey }}
204+ - name: REDIS_HOST_PASSWORD
205+ valueFrom:
206+ secretKeyRef:
207+ name: {{ .Values.externalRedis.existingSecret.secretName | quote }}
208+ key: {{ .Values.externalRedis.existingSecret.passwordKey | quote }}
209+ {{- end }}
210+ {{- else if .Values.externalRedis.password }}
211+ - name: REDIS_HOST_PASSWORD
212+ value: {{ .Values.externalRedis.password | quote }}
169213{{- end }}
214+ {{- end }}{{/* end-of redis-enabled*/ }}
215+ {{- if or
216+ (and .Values.redis.auth.enabled .Values.redis.auth.password )
217+ (and .Values.redis.auth.enabled .Values.redis.auth.existingSecret .Values.redis.auth.existingSecretPasswordKey )
218+ (and .Values.externalRedis.enabled .Values.externalRedis.existingSecret.secretName .Values.externalRedis.existingSecret.passwordKey )
219+ (and .Values.externalRedis.enabled .Values.externalRedis.password )
220+ }}
221+ - name: REDIS_URL
222+ value: " redis://:$(REDIS_HOST_PASSWORD)@$(REDIS_HOST):$(REDIS_HOST_PORT)"
223+ {{- else }}
224+ - name: REDIS_URL
225+ value: " redis://$(REDIS_HOST):$(REDIS_HOST_PORT)"
226+ {{- end }}{{/* end-of redis-url*/ }}
227+ {{- end }}{{/* end-of env.redis definition */ }}
228+
229+ {{- define " nextcloud.env" -}}
230+ {{- if .Values.phpClientHttpsFix.enabled }}
231+ - name: OVERWRITEPROTOCOL
232+ value: {{ .Values.phpClientHttpsFix.protocol | quote }}
233+ {{- end }}
234+ {{- template " nextcloud.env.database" . }}
235+ {{- template " nextcloud.env.redis" . }}
170236- name: NEXTCLOUD_ADMIN_USER
171237 valueFrom:
172238 secretKeyRef:
@@ -221,44 +287,6 @@ Create environment variables used to configure the nextcloud container as well a
221287 key: {{ .Values.nextcloud.existingSecret.smtpPasswordKey }}
222288{{- end }}
223289{{/*
224- Redis env vars
225- */ }}
226- {{- if .Values.redis.enabled }}
227- - name: REDIS_HOST
228- value: {{ template " nextcloud.redis.fullname" . }}-master
229- - name: REDIS_HOST_PORT
230- value: {{ .Values.redis.master.service.ports.redis | quote }}
231- {{- if .Values.redis.auth.enabled }}
232- {{- if and .Values.redis.auth.existingSecret .Values.redis.auth.existingSecretPasswordKey }}
233- - name: REDIS_HOST_PASSWORD
234- valueFrom:
235- secretKeyRef:
236- name: {{ .Values.redis.auth.existingSecret }}
237- key: {{ .Values.redis.auth.existingSecretPasswordKey }}
238- {{- else }}
239- - name: REDIS_HOST_PASSWORD
240- value: {{ .Values.redis.auth.password }}
241- {{- end }}
242- {{- end }}
243- {{- else if .Values.externalRedis.enabled }}
244- - name: REDIS_HOST
245- value: {{ .Values.externalRedis.host | quote }}
246- - name: REDIS_HOST_PORT
247- value: {{ .Values.externalRedis.port | quote }}
248- {{- if .Values.externalRedis.existingSecret.enabled }}
249- {{- if and .Values.externalRedis.existingSecret.secretName .Values.externalRedis.existingSecret.passwordKey }}
250- - name: REDIS_HOST_PASSWORD
251- valueFrom:
252- secretKeyRef:
253- name: {{ .Values.externalRedis.existingSecret.secretName | quote }}
254- key: {{ .Values.externalRedis.existingSecret.passwordKey | quote }}
255- {{- end }}
256- {{- else if .Values.externalRedis.password }}
257- - name: REDIS_HOST_PASSWORD
258- value: {{ .Values.externalRedis.password | quote }}
259- {{- end }}
260- {{- end }}{{/* end if redis.enabled */ }}
261- {{/*
262290S3 as primary object store env vars
263291*/ }}
264292{{- if .Values.nextcloud.objectStore.s3.enabled }}
@@ -363,7 +391,6 @@ Swift as primary object store env vars
363391{{- end }}
364392{{- end -}}
365393
366-
367394{{/*
368395Create volume mounts for the nextcloud container as well as the cron sidecar container.
369396*/ }}
0 commit comments