apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "wordpress.fullname" . }}-extended
  labels:
    {{- include "wordpress.labels" . | nindent 4 }}
data:
  000-default.conf: |
    {{- if .Values.apacheDefaultSiteConfig }}
    {{ .Values.apacheDefaultSiteConfig | nindent 4 }}
    {{- else }}
    <VirtualHost *:{{ .Values.containerPort }}>
            ServerAdmin webmaster@localhost
            DocumentRoot /var/www/html

            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
    {{- end }}
  ports.conf: |
    {{- if .Values.apachePortsConfig }}
    {{ .Values.apachePortsConfig | nindent 4 }}
    {{- else }}
    Listen {{ .Values.containerPort }}
    {{- end }}
  custom.ini: |
    {{- if .Values.customPhpConfig }}
    {{ .Values.customPhpConfig | nindent 4 }}
    {{- else }}
    upload_max_filesize = {{ .Values.settings.maxFileUploadSize }}
    post_max_size = {{ .Values.settings.maxFileUploadSize }}
    memory_limit = {{ .Values.settings.memoryLimit }}
    {{- end }}
