# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2021 Intel Corporation

apiVersion: v1
kind: ConfigMap
metadata:
  name: "{{ .Values.proxy.configMap }}"
  labels:
    name: "{{ .Values.proxy.configMap }}"
  namespace: telemetry
data:
  nginx.conf: |-
    worker_processes  1;
    events {
        worker_connections  1024;
    }

    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile      on;
        keepalive_timeout  65;
        server_tokens off;
        server {
            listen                 {{ .Values.proxy.apiPort }} ssl;
            server_name            {{ .Values.proxy.serverName }};
            ssl_certificate        /opt/grafana/certs/tls.crt;
            ssl_certificate_key    /opt/grafana/certs/tls.key;
            ssl_client_certificate /opt/grafana/certs/root.pem;
            ssl_verify_client      off;
            ssl_protocols          {{ .Values.proxy.protocols }};
            ssl_ciphers            {{ join ":" .Values.proxy.ciphers }};
            location / {
                proxy_pass http://127.0.0.1:{{ .Values.proxy.internalPort }}/;
                }
            }
    }
