{{- if .Values.artifactory.replicator.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ template "artifactory.fullname" . }}-replicator-nginx-config
  labels:
    app: {{ template "artifactory.name" . }}
    chart: {{ template "artifactory.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
data:
  replicator-nginx.conf: |
      ## Artifactory replicator
      server {
        listen         {{ .Values.nginx.externalPortReplicator }};
        server_name    {{ include "artifactory.fullname" . }};

        client_max_body_size 0;

        location / {
          proxy_read_timeout  900;
          proxy_pass_header   Server;
          proxy_pass          http://{{ include "artifactory.fullname" . }}:{{ .Values.nginx.internalPortReplicator }};
          proxy_http_version  1.1;
        }
      }
{{- end -}}