{{- if .Values.postgresql.enabled }}
---
apiVersion: v1
kind: ConfigMap
metadata:
  creationTimestamp: null
  name: {{ .Values.postgresql.primary.initdb.scriptsConfigMap | quote }}
data:
  create-db.sh: |
    #!/bin/sh
    for db in userapi_accounts mediaapi syncapi roomserver keyserver federationapi appservice; do
    createdb -U {{ .Values.postgresql.auth.username }} -O {{ .Values.postgresql.auth.username }} dendrite_$db
    done
{{- end }}
