fix replication user creation

This commit is contained in:
Jeffrey C. Ollie 2023-05-16 16:29:41 -05:00
parent 6648ab0f79
commit 53f14c6fed
Signed by: jeff
GPG key ID: 6F86035A6D97044E

View file

@ -591,14 +591,12 @@
if $PSQL --command "SELECT 1 FROM pg_roles WHERE rolname='${cfg.replication.username}';" | grep -q 1
then
echo "alter replication user ${cfg.replication.username}"
$PSQL \
--variable=v1="''$(<''${CREDENTIALS_DIRECTORY}/postgresql-replication-password)" \
--command "ALTER ROLE ${cfg.replication.username} WITH REPLICATION LOGIN PASSWORD :'v1';"
echo "ALTER ROLE ${cfg.replication.username} WITH REPLICATION LOGIN PASSWORD :'v1';" | $PSQL \
--variable=v1="''$(<''${CREDENTIALS_DIRECTORY}/postgresql-replication-password)"
else
echo "create replication user ${cfg.replication.username}"
$PSQL \
--variable=v1="''$(<''${CREDENTIALS_DIRECTORY}/postgresql-replication-password)" \
--command "CREATE ROLE ${cfg.replication.username} WITH REPLICATION LOGIN PASSWORD :'v1';"
echo "CREATE ROLE ${cfg.replication.username} WITH REPLICATION LOGIN PASSWORD :'v1';" | $PSQL \
--variable=v1="''$(<''${CREDENTIALS_DIRECTORY}/postgresql-replication-password)"
fi
''
else "";