{{/* Make sure all variables are set properly */}}
{{- include "common.values.setup" . }}

{{/* Append the configMap volume to the volumes */}}
{{- define "adguard-home.configVolume" -}}
enabled: "true"
mountPath: "/tmp/AdGuardHome.yaml"
subPath: "AdGuardHome.yaml"
type: "custom"
volumeSpec:
  configMap:
    name: {{ include "common.names.fullname" . }}-config
{{- end -}}
{{- $_ := set .Values.persistence "adguard-home-config" (include "adguard-home.configVolume" . | fromYaml) -}}

{{/* Render the templates */}}
{{ include "common.all" . }}
