---
apiVersion: "v1"
kind: "Secret"
metadata:
  name: "{{ include "common.names.fullname" . }}-core"
  labels:
    {{- include "common.labels.standard" . | nindent 4 }}
stringData:
  {{- if .Values.postgresql.bundled }}
  DATABASE_HOST: {{ printf "%s-postgresql.%s.svc.%s" .Release.Name .Release.Namespace .Values.clusterDomain | quote }}
  DATABASE_PORT: "{{ .Values.postgresql.primary.service.ports.postgresql }}"
  DATABASE_URL: "postgresql://{{ .Values.postgresql.auth.username }}@{{ include "common.names.dependency.fullname" (dict "chartName" "postgresql" "chartValues" .Values.postgresql "context" $) }}:{{ .Values.postgresql.primary.service.ports.postgresql }}/{{ .Values.postgresql.auth.database }}"
  {{- else }}
  DATABASE_HOST: "{{ .Values.postgresql.connection.host }}"
  DATABASE_PORT: "{{ .Values.postgresql.connection.port }}"
  DATABASE_URL: "postgresql://{{ .Values.postgresql.auth.username }}@{{ .Values.postgresql.connection.host }}:{{ .Values.postgresql.connection.port }}/{{ .Values.postgresql.auth.database }}"
  {{- end }}
  OPENPROJECT_SEED_ADMIN_USER_PASSWORD: {{ .Values.openproject.admin_user.password | quote }}
  OPENPROJECT_SEED_ADMIN_USER_PASSWORD_RESET: {{ .Values.openproject.admin_user.password_reset | quote }}
  OPENPROJECT_SEED_ADMIN_USER_NAME: {{ .Values.openproject.admin_user.name | quote }}
  OPENPROJECT_SEED_ADMIN_USER_MAIL: {{ .Values.openproject.admin_user.mail | quote }}
  OPENPROJECT_HTTPS: {{ (.Values.develop | ternary "false" .Values.openproject.https) | quote }}
  OPENPROJECT_SEED_LOCALE: {{ .Values.openproject.seed_locale | quote }}
  {{- if .Values.ingress.enabled }}
  OPENPROJECT_HOST__NAME: {{ .Values.openproject.host | default .Values.ingress.host | quote }}
  {{- end }}
  OPENPROJECT_HSTS: {{ .Values.openproject.hsts | quote }}
  OPENPROJECT_RAILS__CACHE__STORE: {{ .Values.openproject.cache.store | quote }}
  OPENPROJECT_RAILS__RELATIVE__URL__ROOT: {{ .Values.openproject.railsRelativeUrlRoot | default "" | quote }}
  POSTGRES_STATEMENT_TIMEOUT: {{ .Values.openproject.postgresStatementTimeout | quote }}
...
