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

105 lines
6.1 KiB
YAML
Raw Normal View History

2023-03-02 06:14:16 +05:30
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "backend.names.fullname" . }}-config
2023-03-04 05:22:18 +05:30
{{- with (merge (.Values.backend.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }}
2023-03-02 06:14:16 +05:30
labels: {{- toYaml . | nindent 4 }}
{{- end }}
2023-03-04 05:22:18 +05:30
{{- with (merge (.Values.backend.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
2023-03-02 06:14:16 +05:30
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
data:
config.properties: |
2023-03-04 05:22:18 +05:30
{{- 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 06:14:16 +05:30
{{- 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-04 05:22:18 +05:30
{{- else if (and .Values.ingress.ytproxy.enabled .Values.ingress.ytproxy.tls) }}
2023-03-02 11:03:21 +05:30
PROXY_PART: https://{{ index (index .Values.ingress.ytproxy.hosts 0) "host" }}
2023-03-04 05:22:18 +05:30
{{- else if .Values.ingress.ytproxy.enabled }}
PROXY_PART: http://{{ index (index .Values.ingress.ytproxy.hosts 0) "host" }}
2023-03-02 06:14:16 +05:30
{{- else }}
{{- fail "PROXY_PART needs to be set in config values or ytproxy ingress must be enabled."}}
{{ end }}
{{- if (and .Values.backend.config.REQWEST_PROXY .Values.backend.config.REQWEST_PROXY_USER .Values.backend.config.REQWEST_PROXY_PASS) }}
REQWEST_PROXY: {{ .Values.backend.config.REQWEST_PROXY }}
REQWEST_PROXY_USER: {{ .Values.backend.config.REQWEST_PROXY_USER }}
REQWEST_PROXY_PASS: {{ .Values.backend.config.REQWEST_PROXY_PASS }}
{{- else if and (not .Values.backend.config.REQWEST_PROXY_USER) (not .Values.backend.config.REQWEST_PROXY_PASS) (.Values.backend.config.REQWEST_PROXY) }}
REQWEST_PROXY: {{ .Values.backend.config.REQWEST_PROXY }}
{{- end }}
{{- if .Values.backend.config.CAPTCHA_BASE_URL }}
CAPTCHA_BASE_URL: {{ .Values.backend.config.CAPTCHA_BASE_URL }}
{{- else if (and .Values.backend.config.CAPTCHA_BASE_URL .Values.backend.config.CAPTCHA_API_KEY) }}
CAPTCHA_BASE_URL: {{ .Values.backend.config.CAPTCHA_BASE_URL }}
CAPTCHA_API_KEY: {{ .Values.backend.config.CAPTCHA_API_KEY }}
{{- end}}
2023-03-02 06:14:16 +05:30
{{- if .Values.backend.config.API_URL }}
API_URL: {{ .Values.backend.config.API_URL }}
2023-03-04 05:22:18 +05:30
{{- 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 06:14:16 +05:30
{{- else if .Values.ingress.backend.enabled }}
2023-03-04 05:22:18 +05:30
API_URL: http://{{ index (index .Values.ingress.backend.hosts 0) "host" }}
2023-03-02 06:14:16 +05:30
{{- 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-04 05:22:18 +05:30
{{- 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 06:14:16 +05:30
{{- 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.FEED_RETENTION | default 30 | int }}
{{- if and (.Values.backend.config.database) (not .Values.postgresql.enabled) }}
2023-03-02 06:14:16 +05:30
hibernate.connection.url: {{.Values.backend.config.database.connection_url }}
{{- if and (not .Values.backend.config.database.driver_class) (not .Values.backend.config.database.dialect) }}
hibernate.connection.driver_class: org.postgresql.Driver
hibernate.dialect: org.hibernate.dialect.PostgreSQLDialect
{{ end }}
{{- if and (.Values.backend.config.database) (.Values.backend.config.database.driver_class) (.Values.backend.config.database.dialect) (not .Values.postgresql.enabled)}}
2023-03-02 06:14:16 +05:30
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 }}
{{ end }}
{{- if and (.Values.backend.config.database.secret) (.Values.backend.config.database.secret.name) }}
hibernate.connection.username: {{ include "common.getValueFromSecret" (dict "Namespace" .Release.Namespace "Name" .Values.backend.config.database.secret.name "Key" (.Values.backend.config.database.secret.username | default "DB_USERNAME")) }}
hibernate.connection.password: {{ include "common.getValueFromSecret" (dict "Namespace" .Release.Namespace "Name" .Values.backend.config.database.secret.name "Key" (.Values.backend.config.database.secret.password | default "DB_PASSWORD")) }}
{{- end }}
2023-03-02 06:14:16 +05:30
{{- else if .Values.postgresql.enabled }}
hibernate.connection.url: jdbc:postgresql://piped-postgresql/{{ .Values.postgresql.auth.database}}
hibernate.connection.driver_class: org.postgresql.Driver
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-04 05:22:18 +05:30
{{- end }}
{{- if .Values.backend.config.SENTRY_DNS }}
SENTRY_DSN: {{.Values.backend.SENTRY_DNS }}
{{- else }}
2023-03-02 06:14:16 +05:30
SENTRY_DSN:
{{- end }}
{{- if (and .Values.backend.config.MATRIX_SERVER .Values.backend.config.MATRIX_TOKEN) }}
MATRIX_SERVER: {{.Values.backend.config.MATRIX_SERVER }}
MATRIX_TOKEN: {{ .Values.backend.config.MATRIX_TOKEN }}
{{- else if (not .Values.backend.config.MATRIX_TOKEN) }}
MATRIX_SERVER: https://matrix-client.matrix.org
{{- end }}