deployment/scripts/databases.sh

16 lines
510 B
Bash
Raw Permalink Normal View History

#!/bin/bash
SUDOER_PSW=
2024-12-06 21:50:54 -05:00
function restofscript(){
pw_productiondatabase=
pw_developmentdatabase=
servicename=
service_dev="${servicename}_dev"
sudo -u postgres psql -c "create database $servicename;"
sudo -u postgres psql -c "create user $servicename with encrypted password '$pw_productiondatabase';"
sudo -u postgres psql -c "grant all privileges on database $servicename to $servicename;"
}
2024-12-06 21:50:54 -05:00
echo "${SUDOER_PSW}" | sudo -S bash -c "$(declare -f restofscript); restofscript"
exit