File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -33,8 +33,7 @@ wait_postgres
3333
3434# Is this a bad idea?
3535# Required for the GRANT below
36- current_user=" ${user:- ${PGUSER:- ${USER} } } "
37-
36+ current_user=" ${username:- ${PGUSER:- ${USER} } } "
3837
3938echoerr " >>> Creating new user (ROLE)"
4039# Check is new user already exists
@@ -44,7 +43,7 @@ if [[ "$(/usr/bin/psql "${connection[@]}" -tAc "SELECT 1 FROM pg_roles WHERE rol
4443 new_password=" $( genpasswd) "
4544 echoerr " >>> Generated a random password: ${new_password} "
4645 else
47- new_password=" ${args[2 ]} "
46+ new_password=" ${args[1 ]} "
4847 fi
4948 /usr/bin/psql " ${connection[@]} " -c " CREATE ROLE ${new_user} WITH LOGIN PASSWORD '${new_password} ';"
5049else
7069 # shellcheck disable=SC2034
7170 dbname=" ${new_user} "
7271 connection=()
73- for item in host port user dbname; do
72+ for item in host port username dbname; do
7473 if [[ -n " ${! item:- } " ]]; then
75- connection+=(" --${item} " " ${! item} " )
74+ connection+=(" --${item} = ${! item} " )
7675 fi
7776 done
7877
You can’t perform that action at this time.
0 commit comments