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

77 lines
4.1 KiB
YAML
Raw Normal View History

2023-03-02 00:44:16 +00:00
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "backend.names.fullname" . }}-config
2023-03-03 23:52:18 +00:00
{{- with (merge (.Values.backend.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }}
2023-03-02 00:44:16 +00:00
labels: {{- toYaml . | nindent 4 }}
{{- end }}
2023-03-03 23:52:18 +00:00
{{- with (merge (.Values.backend.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
2023-03-02 00:44:16 +00:00
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
data:
config.properties: |
2023-03-03 23:52:18 +00:00
{{- 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 }}
2023-03-02 00:44:16 +00:00
{{- 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 }}
2023-03-03 23:52:18 +00:00
{{- else if (and .Values.ingress.ytproxy.enabled .Values.ingress.ytproxy.tls) }}
2023-03-02 05:33:21 +00:00
PROXY_PART: https://{{ index (index .Values.ingress.ytproxy.hosts 0) "host" }}
2023-03-03 23:52:18 +00:00
{{- else if .Values.ingress.ytproxy.enabled }}
PROXY_PART: http://{{ index (index .Values.ingress.ytproxy.hosts 0) "host" }}
2023-03-02 00:44:16 +00:00
{{- 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 }}
2023-03-03 23:52:18 +00:00
{{- else if (and .Values.ingress.backend.enabled .Values.ingress.backend.tls) }}
API_URL: https://{{ index (index .Values.ingress.backend.hosts 0) "host" }}
2023-03-02 00:44:16 +00:00
{{- else if .Values.ingress.backend.enabled }}
2023-03-03 23:52:18 +00:00
API_URL: http://{{ index (index .Values.ingress.backend.hosts 0) "host" }}
2023-03-02 00:44:16 +00:00
{{- 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 }}
2023-03-03 23:52:18 +00:00
{{- else if (and .Values.ingress.main.enabled .Values.ingress.main.tls) }}
FRONTEND_URL: https://{{ index (index .Values.ingress.main.hosts 0) "host" }}
2023-03-02 00:44:16 +00:00
{{- 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) }}
2023-03-02 00:44:16 +00:00
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 }}
2023-03-02 00:44:16 +00:00
{{- 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."}}
2023-03-03 23:52:18 +00:00
{{- end }}
2023-03-02 00:44:16 +00:00
SENTRY_DSN: