apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "common.names.fullname" . }}
  labels:
    {{- include "common.labels.standard" $ | nindent 4 }}
    {{- if .Values.commonLabels }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
    {{- end }}
  {{- if .Values.commonAnnotations }}
  annotations:
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  {{- end }}
data:
  APP_URL: {{ include "invoiceninja.url" . | quote }}
  APP_DEBUG: {{ .Values.debug | quote }}
  DB_HOST: {{ include "invoiceninja.databaseHost" . | quote }}
  DB_PORT: {{ include "invoiceninja.databasePort" . | quote }}
  DB_USERNAME: {{ include "invoiceninja.databaseUser" . | quote }}
  DB_DATABASE: {{ include "invoiceninja.databaseName" . | quote }}
  {{- if .Values.logChannel }}
  LOG_CHANNEL: {{ .Values.logChannel | quote }}
  {{- else }}
  LOG_CHANNEL: stderr
  {{- end }}
  MAIL_MAILER: {{ .Values.mailer | quote }}
  {{- if .Values.broadcastDriver }}
  BROADCAST_DRIVER: {{ .Values.broadcastDriver | quote }}
  {{- else if or .Values.redis.enabled .Values.externalRedis.host }}
  BROADCAST_DRIVER: redis
  {{- end }}
  {{- if .Values.cacheDriver }}
  CACHE_DRIVER: {{ .Values.cacheDriver | quote }}
  {{- else if or .Values.redis.enabled .Values.externalRedis.host }}
  CACHE_DRIVER: redis
  {{- end }}
  {{- if .Values.sessionDriver }}
  SESSION_DRIVER: {{ .Values.sessionDriver | quote }}
  {{- else if or .Values.redis.enabled .Values.externalRedis.host }}
  SESSION_DRIVER: redis
  {{- end }}
  {{- if .Values.queueConnection }}
  QUEUE_CONNECTION: {{ .Values.queueConnection | quote }}
  {{- else if or .Values.redis.enabled .Values.externalRedis.host }}
  QUEUE_CONNECTION: redis
  {{- end }}
  # PHANTOMJS_PDF_GENERATION is deprecated
  PHANTOMJS_PDF_GENERATION: "false"
  PDF_GENERATOR: {{ .Values.pdfGenerator | quote}}
  REDIS_HOST: {{ include "invoiceninja.redisHost" . | quote }}
  REDIS_PORT: {{ include "invoiceninja.redisPort" . | quote }}
  REDIS_DB: {{ include "invoiceninja.redisDatabase" . | quote }}
  REDIS_CACHE_DB: {{ include "invoiceninja.redisCacheDatabase" . | quote }}
  REDIS_BROADCAST_CONNECTION: {{ include "invoiceninja.redisBroadcastConnection" . | quote }}
  REDIS_CACHE_CONNECTION: {{ include "invoiceninja.redisCacheConnection" . | quote }}
  REDIS_QUEUE_CONNECTION: {{ include "invoiceninja.redisQueueConnection" . | quote }}
  SESSION_CONNECTION: {{ include "invoiceninja.redisSessionConnection" . | quote }}
  REQUIRE_HTTPS: {{ .Values.requireHttps | quote }}
  TRUSTED_PROXIES: {{ .Values.trustedProxies | quote }}
