---
{%- from "postgresql/map.jinja" import postgresql with context %}
postgresql-config-main:
  file.keyvalue:
    - name: {{ postgresql.configpath }}/postgresql.conf
    - key_values: {{ postgresql.config.main }}
    - separator: ' = '
    - uncomment: '# '
    - key_ignore_case: True
    - append_if_not_found: True
    - watch_in:
      - service: postgresql-service

postgresql-config-hba:
  file.managed:
    - name: {{ postgresql.configpath }}/pg_hba.conf
    - source: salt://postgresql/templates/pg_hba.conf.j2
    - template: jinja
    - watch_in:
      - service: postgresql-service