{{- if .Values.global.webhook.enabled }}
{{- $namespace := .Release.Namespace -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "common.names.fullname" . }}-webhook-config
  namespace: {{ $namespace }}
  labels:
    cmii.additional: webhook
    {{- include "common.labels.standard" . | nindent 4 }}
data:
  minio_notify_webhook_enable_1: "on"
  minio_notify_webhook_endpoint_1: "http://127.0.0.1:{{ .Values.global.webhook.port }}/minio/events"
  minio_notify_webhook_queue_dir_1: ""
  config.json: |
    {
      "version": "10",
      "aliases": {
        "server": {
          "url": "http://127.0.0.1:{{ .Values.containerPort }}",
          "accessKey": "{{ .Values.gateway.auth.nas.accessKey }}",
          "secretKey": "{{ .Values.gateway.auth.nas.secretKey }}",
          "api": "S3v4",
          "path": "auto"
        }
      }
    }
  downloads.json: |
    {
        "version": "1",
        "shares": {}
    }
  uploads.json: |
    {
        "version": "1",
        "shares": {}
    }
---
{{- end }}
