I'm looking for a way to edit pg_hba.conf programmatically, similar to how pg_conftool allows you to edit postgresql.conf:
~$ pg_conftool 11 main set timezone 'UTC'
I tried using pg_conftool to edit pg_hba.conf. Unfortunately, it only allows key = value entries to be added / removed, which is not the format pg_hba.conf expects.
I can use echo and sed to achieve what I want, but I'm wondering if there's a better way. I found a tool pg_hba in postgresql-common that seems to be what I'm looking for:
https://salsa.debian.org/postgresql/postgresql-common
https://salsa.debian.org/postgresql/postgresql-common/blob/master/pg_hba
I have postgresql-common version 201.pgdg18.04+1 installed, however, I can't figure out how to access / install / invoke pg_hba.
Is the pg_hba tool the right tool for the job? If yes, how do I "install" the pg_hba binary for Ubuntu? If no, is there another recommended approach for programmatically editing pg_hba.conf?