databases script update
All checks were successful
gitea.arg.rip/deployment/pipeline/head This commit looks good
All checks were successful
gitea.arg.rip/deployment/pipeline/head This commit looks good
This commit is contained in:
parent
9b70bd9480
commit
a47de1098c
@ -1,19 +1,20 @@
|
||||
#!/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 -Su postgres psql && bash -s << 'ENDPSQL'
|
||||
create database $servicename;
|
||||
create user $servicename with encrypted password '$pw_productiondatabase';
|
||||
grant all privileges on database $servicename to $servicename;
|
||||
sudo -u postgres psql -c "create database $service_dev;"
|
||||
sudo -u postgres psql -c "create user $service_dev with encrypted password '$pw_developmentdatabase';"
|
||||
sudo -u postgres psql -c "grant all privileges on database $service_dev to $service_dev;"
|
||||
|
||||
create database $service_dev;
|
||||
create user $service_dev with encrypted password '$pw_developmentdatabase';
|
||||
grant all privileges on database $service_dev to $service_dev;
|
||||
ENDPSQL
|
||||
}
|
||||
|
||||
echo "${SUDOER_PSW}" | sudo -S bash -c "$(declare -f restofscript); restofscript"
|
||||
exit
|
||||
|
Loading…
Reference in New Issue
Block a user