{{- define "dendrite.keyVolume" -}}
enabled: {{ .Values.dendrite.matrix_key_secret.enabled }}
type: "custom"
volumeSpec:
  secret:
    defaultMode: 0600
    secretName: {{ include "dendrite.names.key" . }}
subPath:
  - path: {{ .Values.dendrite.matrix_key_secret.secretPath }}
    mountPath: "/etc/dendrite/matrix_key.pem"
{{- end -}}
{{- define "dendrite.tlsVolume" -}}
enabled: {{ .Values.dendrite.tls_secret.enabled }}
type: "custom"
volumeSpec:
  secret:
    defaultMode: 0600
    secretName: {{ .Values.dendrite.tls_secret.existingSecret }}
subPath:
  - path: {{ .Values.dendrite.tls_secret.crtPath }}
    mountPath: "/etc/dendrite/server.crt"
  - path: {{ .Values.dendrite.tls_secret.keyPath }}
    mountPath: "/etc/dendrite/server.key"
{{- end -}}
{{- define "dendrite.configVolume" -}}
enabled: true
type: "custom"
volumeSpec:
  secret:
    defaultMode: 0600
    secretName: {{ include "common.names.fullname" . }}-config
subPath:
  - path: dendrite.yaml
    mountPath: "/etc/dendrite/dendrite.yaml"
{{- end -}}
