{{- $name := include "webspa.fullname" . -}}
{{- $identity := include "url-of" (list .Values.app.ingress.entries.identity .) -}}
{{- $webshoppingapigw := include "url-of" (list .Values.app.ingress.entries.webshoppingapigw .) -}}
{{- $webmarketingapigw := include "url-of" (list .Values.app.ingress.entries.webmarketingapigw .) -}}
{{- $spa := include "url-of" (list .Values.app.ingress.entries.spa .) -}}
{{- $mongo := include "mongo-name" . -}}
{{- $protocol := include "protocol" . -}}

apiVersion: v1
kind: ConfigMap
metadata:
  name: "cfg-{{ $name }}"
  labels:
    app: {{ template "webspa.name" . }}
    chart: {{ template "webspa.chart" .}}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
data:
  all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
  all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}"
  webspa__keystore: {{ .Values.inf.redis.keystore.constr }}
  internalurls__apigwws: http://{{ .Values.app.svc.webshoppingapigw }}
  internalurls__identity__hc: http://{{ .Values.app.svc.identity }}/hc
  urls__apigwws: {{ $protocol }}://{{ $webshoppingapigw }}
  urls__spa: {{ $protocol }}://{{ $spa }}
  urls__IdentityUrl: {{ $protocol }}://{{ $identity }}
  urls__apigwwm: {{ $protocol }}://{{ $webmarketingapigw }}