{{- if .Values.enabled -}}
    {{- if .Values.provisioning.enabled -}}
        {{- if not (and .Values.persistence.enabled .Values.persistence.mount) -}}
            {{- fail "persistence.enabled and persistence.mount are required when provisioning is enabled" -}}
        {{- end -}}
        {{- if and .Values.persistence.enabled .Values.persistence.mount -}}
            {{- if .Values.existingSecret -}}
                {{- fail "Can't specify both actions.provisioning.enabled and actions.existingSecret" -}}
            {{- end -}}
        {{- end -}}
    {{- end -}}
    {{- if and (not .Values.provisioning.enabled) (or (empty .Values.existingSecret) (empty .Values.existingSecretKey)) -}}
        {{- fail "existingSecret and existingSecretKey are required when provisioning is disabled" -}}
    {{- end -}}
    {{- if not .Values.giteaRootURL -}}
        {{- fail "giteaRootURL is required" -}}
    {{- end -}}
{{- end -}}