{{/*
AUTOGENERATED FILE - DO NOT EDIT.
Generated by scripts/generate_env_tpls.py from charts/agentarea/config.yaml
*/}}

{{- define "agentarea.databaseJobs.configVars" -}}
POSTGRES_HOST: "{{ include "agentarea.database.host" . }}"
POSTGRES_PORT: "{{ .Values.global.database.port }}"
POSTGRES_DB: "{{ .Values.global.database.name }}"
POSTGRES_SSLMODE: "{{ .Values.global.database.sslMode }}"
{{- end }}

{{- define "agentarea.databaseJobs.envs" }}
- name: POSTGRES_HOST
  valueFrom:
    configMapKeyRef:
      name: {{ include "agentarea.fullname" . }}-env-databasejobs
      key: POSTGRES_HOST
- name: POSTGRES_PORT
  valueFrom:
    configMapKeyRef:
      name: {{ include "agentarea.fullname" . }}-env-databasejobs
      key: POSTGRES_PORT
- name: POSTGRES_DB
  valueFrom:
    configMapKeyRef:
      name: {{ include "agentarea.fullname" . }}-env-databasejobs
      key: POSTGRES_DB
- name: POSTGRES_SSLMODE
  valueFrom:
    configMapKeyRef:
      name: {{ include "agentarea.fullname" . }}-env-databasejobs
      key: POSTGRES_SSLMODE
- name: DATABASE_URL
  value: postgresql+psycopg2://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB)?sslmode={{ .Values.global.database.sslMode }}
{{- end }}

{{- define "agentarea.databaseJobs.secrets.envs" }}
- name: POSTGRES_USER
  valueFrom:
    secretKeyRef:
      name: "{{ .Values.global.secrets.postgresql }}"
      key: username
- name: POSTGRES_PASSWORD
  valueFrom:
    secretKeyRef:
      name: "{{ .Values.global.secrets.postgresql }}"
      key: password
{{- end }}
