{{- $name := include "mobileshoppingagg.fullname" . -}}
{{- $identity := include "url-of" (list .Values.app.ingress.entries.identity .) -}}
{{- $protocol := include "protocol" . -}}

apiVersion: v1
kind: ConfigMap
metadata:
  name: "cfg-{{ $name }}"
  labels:
    app: {{ template "mobileshoppingagg.name" . }}
    chart: {{ template "mobileshoppingagg.chart" .}}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
data:
  all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
  mobileshoppingagg__keystore: {{ .Values.inf.redis.keystore.constr }}
  internalurls__basket: http://{{ .Values.app.svc.basket }}
  internalurls__catalog: http://{{ .Values.app.svc.catalog }}
  internalurls__identity: http://{{ .Values.app.svc.identity }}
  internalurls__ordering: http://{{ .Values.app.svc.ordering }}
  internalurls__basket__hc: http://{{ .Values.app.svc.basket }}/hc
  internalurls__catalog__hc: http://{{ .Values.app.svc.catalog }}/hc
  internalurls__identity__hc: http://{{ .Values.app.svc.identity }}/hc
  internalurls__ordering__hc: http://{{ .Values.app.svc.ordering }}/hc
  internalurls__payment__hc: http://{{ .Values.app.svc.payment }}/hc
  internalurls__grpcBasket: "http://{{ .Values.app.svc.basket }}:{{ .Values.service.grpcPort }}"
  internalurls__grpcCatalog: "http://{{ .Values.app.svc.catalog }}:{{ .Values.service.grpcPort }}"
  internalurls__grpcOrdering: "http://{{ .Values.app.svc.ordering }}:{{ .Values.service.grpcPort }}"
  urls__IdentityUrlExternal: {{ $protocol }}://{{ $identity }}