Piped-Kubernetes/charts/apps/piped/templates/backend/configmap.yaml

77 lines
4.1 KiB
YAML

---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "backend.names.fullname" . }}-config
{{- with (merge (.Values.backend.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }}
labels: {{- toYaml . | nindent 4 }}
{{- end }}
{{- with (merge (.Values.backend.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
data:
config.properties: |
{{- if .Values.backend.config.PORT }}
PORT: {{ .Values.backend.config.PORT }}
{{- else }}
PORT: 8080
{{ end }}
{{- if .Values.backend.config.HTTP_WORKERS }}
HTTP_WORKERS: {{ .Values.backend.config.HTTP_WORKERS }}
{{- else }}
HTTP_WORKERS: 2
{{ end }}
{{- if .Values.backend.config.HTTP_PROXY }}
HTTP_PROXY: {{ .Values.backend.config.HTTP_PROXY }}
{{ end }}
{{- if .Values.backend.config.PROXY_PART }}
PROXY_PART: {{.Values.backend.config.PROXY_PART }}
{{- else if (and .Values.ingress.ytproxy.enabled .Values.ingress.ytproxy.tls) }}
PROXY_PART: https://{{ index (index .Values.ingress.ytproxy.hosts 0) "host" }}
{{- else if .Values.ingress.ytproxy.enabled }}
PROXY_PART: http://{{ index (index .Values.ingress.ytproxy.hosts 0) "host" }}
{{- else }}
{{- fail "PROXY_PART needs to be set in config values or ytproxy ingress must be enabled."}}
{{ end }}
{{- if .Values.backend.config.API_URL }}
API_URL: {{ .Values.backend.config.API_URL }}
{{- else if (and .Values.ingress.backend.enabled .Values.ingress.backend.tls) }}
API_URL: https://{{ index (index .Values.ingress.backend.hosts 0) "host" }}
{{- else if .Values.ingress.backend.enabled }}
API_URL: http://{{ index (index .Values.ingress.backend.hosts 0) "host" }}
{{- else }}
{{- fail "API_URL needs to be set in config values or backend ingress must be enabled."}}
{{ end }}
{{- if .Values.backend.config.FRONTEND_URL }}
FRONTEND_URL: {{.Values.backend.config.FRONTEND_URL }}
{{- else if (and .Values.ingress.main.enabled .Values.ingress.main.tls) }}
FRONTEND_URL: https://{{ index (index .Values.ingress.main.hosts 0) "host" }}
{{- else if .Values.ingress.main.enabled }}
FRONTEND_URL: {{ index (index .Values.ingress.main.hosts 0) "host" }}
{{- else }}
{{- fail "FRONTEND_URL needs to be set in config values or main ingress must be enabled."}}
{{ end }}
COMPROMISED_PASSWORD_CHECK: {{ .Values.backend.config.COMPROMISED_PASSWORD_CHECK | default true }}
DISABLE_REGISTRATION: {{ .Values.backend.config.DISABLE_REGISTRATION | default false }}
FEED_RETENTION: {{ .Values.backend.config.DISABLE_REGISTRATION | int | default 30 }}
{{- if and (.Values.backend.config.database) (not .Values.postgresql.enabled) }}
hibernate.connection.url: {{.Values.backend.config.database.connection_url }}
hibernate.connection.driver_class: {{.Values.backend.config.database.driver_class }}
hibernate.dialect: {{.Values.backend.config.database.dialect }}
hibernate.connection.username: {{.Values.backend.config.database.username }}
hibernate.connection.password: {{.Values.backend.config.database.password }}
{{- if .Values.backend.config.database.secret }}
hibernate.connection.username: {{ include "common.getValueFromSecret" (dict "Namespace" .Release.Namespace "Name" .Values.backend.config.database.secret "Key" "database.username" ) -}}
hibernate.connection.password: {{ include "common.getValueFromSecret" (dict "Namespace" .Release.Namespace "Name" .Values.backend.config.database.secret "Key" "database.password") -}}
{{- end }}
{{- else if .Values.postgresql.enabled }}
hibernate.connection.url: jdbc:postgresql://piped-postgresql/{{ .Values.postgresql.auth.database}}
hibernate.connection.driver_class: org.postgresql.Driver
hibernate.dialect: org.hibernate.dialect.PostgreSQLDialect
hibernate.connection.username: {{.Values.postgresql.auth.username }}
hibernate.connection.password: {{.Values.postgresql.auth.password }}
{{- else }}
{{- fail "Unable to figure out database configuration for backend configmap."}}
{{- end }}
SENTRY_DSN: