{{- $name := include "identity-api.fullname" . -}}
{{- $sqlsrv := include "sql-name" . -}}
{{- $mvc_url := include "url-of" (list .Values.app.ingress.entries.mvc  .) -}}
{{- $spa_url := include "url-of" (list .Values.app.ingress.entries.spa .) -}}
{{- $locations_url := include "url-of" (list .Values.app.ingress.entries.locations .) -}}
{{- $marketing_url := include "url-of" (list .Values.app.ingress.entries.marketing .) -}}
{{- $basket_url := include "url-of" (list .Values.app.ingress.entries.basket .) -}}
{{- $ordering_url := include "url-of" (list .Values.app.ingress.entries.ordering .) -}}
{{- $mobileshoppingagg := include "url-of" (list .Values.app.ingress.entries.mobileshoppingagg .) -}}
{{- $webhoppingagg := include "url-of" (list .Values.app.ingress.entries.webshoppingagg .) -}}
{{- $xamarincallback := include "url-of" (list "xamarincallback" .) -}}
{{- $webhooks_url := include "url-of" (list .Values.app.ingress.entries.webhooks .) -}}
{{- $webhooksweb_url := include "url-of" (list .Values.app.ingress.entries.webhooksweb .) -}}

apiVersion: v1
kind: ConfigMap
metadata:
  name: "cfg-{{ $name }}"
  labels:
    app: {{ template "identity-api.name" . }}
    chart: {{ template "identity-api.chart" .}}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
data:
  identity__ConnectionString: Server={{ $sqlsrv }};Initial Catalog={{ .Values.inf.sql.identity.db }};User Id={{ .Values.inf.sql.common.user }};Password={{ .Values.inf.sql.common.pwd }};
  identity__keystore: {{ .Values.inf.redis.keystore.constr }}
  all__InstrumentationKey: {{ .Values.inf.appinsights.key }}
  mvc_e: http://{{ $mvc_url }}
  spa_e: http://{{ $spa_url }}
  locations_e: http://{{ $locations_url }}
  marketing_e: http://{{ $marketing_url }}
  basket_e: http://{{ $basket_url }}
  ordering_e: http://{{ $ordering_url }}
  mobileshoppingagg_e: http://{{ $mobileshoppingagg }}
  webshoppingagg_e: http://{{ $webhoppingagg }}
  xamarin_callback_e: http://{{ $xamarincallback }}
  webhooksapi_e:  http://{{ $webhooks_url }}
  webhooksweb_e: http://{{ $webhooksweb_url }}