adam
88419c8985
All checks were successful
gitea.arg.rip/deployment/pipeline/head This commit looks good
16 lines
510 B
Bash
16 lines
510 B
Bash
#!/bin/bash
|
|
|
|
SUDOER_PSW=
|
|
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;"
|
|
}
|
|
|
|
echo "${SUDOER_PSW}" | sudo -S bash -c "$(declare -f restofscript); restofscript"
|
|
exit
|