mirror of
https://github.com/TeamPiped/Piped-Kubernetes.git
synced 2025-04-26 23:00:31 +05:30
feat: Implictly set BACKEND_HOSTNAME for frontend if backend ingress is enabled.
Closes #37
This commit is contained in:
parent
7ef0f91785
commit
2dcb426d0b
@ -1,7 +1,17 @@
|
||||
{{- if .Values.frontend.env }}
|
||||
{{- $envVar := .Values.frontend.env.BACKEND_HOSTNAME }}
|
||||
{{ else if .Values.ingress.main.enabled }}
|
||||
{{- $envVar := index (index .Values.ingress.main.hosts 0) "host" }}
|
||||
{{- else }}
|
||||
{{- fail "Frontend container environment is missing a required variable BACKEND_HOSTNAME or main ingress is not enabled." .Values.frontend.env }}
|
||||
{{- define "frontend.configValidation" }}
|
||||
{{- $envVar := "" }}
|
||||
{{- if .Values.frontend.env }}
|
||||
{{- $envVar = .Values.frontend.env.BACKEND_HOSTNAME }}
|
||||
{{- else if .Values.ingress.backend.enabled }}
|
||||
{{- if (and (hasKey .Values.ingress.backend "hosts") (gt (len .Values.ingress.backend.hosts) 0)) }}
|
||||
{{- $envVar = index (index .Values.ingress.backend.hosts 0) "host" }}
|
||||
{{- end }}
|
||||
{{- else if .Values.ingress.main.enabled }}
|
||||
{{- if (and (hasKey .Values.ingress.main "hosts") (gt (len .Values.ingress.main.hosts) 0)) }}
|
||||
{{- $envVar = index (index .Values.ingress.main.hosts 0) "host" }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- fail "Frontend container environment is missing a required variable BACKEND_HOSTNAME, main or backend ingress is not enabled." .Values.frontend.env }}
|
||||
{{- end }}
|
||||
{{- $envVar }} # Return the value of $envVar
|
||||
{{- end }}
|
@ -2,7 +2,9 @@
|
||||
Environment variables used by containers.
|
||||
*/}}
|
||||
{{- define "frontend.controller.env_vars" -}}
|
||||
{{- $values := merge .Values.frontend.env -}}
|
||||
{{- $envVar := include "frontend.configValidation" . | trim | quote }}
|
||||
{{- $values := merge .Values.frontend.env (dict "BACKEND_HOSTNAME" $envVar) -}}
|
||||
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.env -}}
|
||||
{{- $values = . -}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user