Files
wlan-cloud-helm/tip-wlan/resources/scripts/creation-replication-user-role.sh
4c74356b41 a3e523f922 Feature/thirdparties (#49)
* thirdparties replaced with latest bitnami charts

* migration values example for persistence, dev-local example for thirdparties

* removing hardcoded passwords

* changing storage classes to mimic what minikube has

* fixing missing folder

* fixing PR comments, fixing testing build

* forgot to fix the namespace in the testing build

* fixing path issues

* fixing another path issue

* fixing build issues

* improving namespace support

* fixing cleanup task

* fixing yaml files

* further yaml formatting

* Update README.md

* Update testing.yml

Co-authored-by: Gleb Boushev <4c74356b41@outlook.com>
Co-authored-by: Leonid Mirsky <leonid@opsfleet.com>
2021-01-28 16:51:39 +02:00

10 lines
822 B
Bash

#!/bin/bash
# Creates user repl_user using ssl certs
if [[ $POSTGRES_REPLICATION_MODE == "master" ]]
then
psql 'host=localhost port=5432 user=postgres sslmode=verify-ca sslcert=/opt/bitnami/postgresql/certs/postgresclientcert.pem sslkey=/opt/bitnami/postgresql/certs/postgresclientkey_dec.pem sslrootcert=/opt/bitnami/postgresql/certs/cacert.pem' -tc \
"SELECT 1 FROM pg_roles WHERE rolname = '$POSTGRES_REPLICATION_USER'" | grep -q 1 \
|| psql 'host=localhost port=5432 user=postgres sslmode=verify-ca sslcert=/opt/bitnami/postgresql/certs/postgresclientcert.pem sslkey=/opt/bitnami/postgresql/certs/postgresclientkey_dec.pem sslrootcert=/opt/bitnami/postgresql/certs/cacert.pem' -c \
"CREATE ROLE $POSTGRES_REPLICATION_USER WITH REPLICATION LOGIN ENCRYPTED PASSWORD '$POSTGRES_REPLICATION_PASSWORD';"
fi