{{ if (gt (len (.Files.Glob "appservices/*")) 0) }}
---
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "dendrite.fullname" . }}-appservices-conf
  namespace: {{ .Release.Namespace }}
type: Opaque
data:
{{ (.Files.Glob "appservices/*").AsSecrets | indent 2 }}
{{ end }}
{{ if and .Values.signing_key.create (not .Values.signing_key.existingSecret) }}
---
apiVersion: v1
kind: Secret
metadata:
  annotations:
    helm.sh/resource-policy: keep
  name: {{ include "dendrite.fullname" . }}-signing-key
  namespace: {{ .Release.Namespace }}
type: Opaque
{{ end }}

---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
  name: {{ include "dendrite.fullname" . }}-conf
  namespace: {{ .Release.Namespace }}
stringData:
  dendrite.yaml: |
    {{ toYaml ( mustMergeOverwrite .Values.dendrite_config  ( fromYaml (include "override.config" .) ) .Values.dendrite_config ) | nindent 4 }}