File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
Filter options
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
33
33
34
34
# Is this a bad idea?
35
35
# Required for the GRANT below
36
- current_user=" ${user:- ${PGUSER:- ${USER} } } "
37
-
36
+ current_user=" ${username:- ${PGUSER:- ${USER} } } "
38
37
39
38
echoerr " >>> Creating new user (ROLE)"
40
39
# Check is new user already exists
@@ -44,7 +43,7 @@ if [[ "$(/usr/bin/psql "${connection[@]}" -tAc "SELECT 1 FROM pg_roles WHERE rol
44
43
new_password=" $( genpasswd) "
45
44
echoerr " >>> Generated a random password: ${new_password} "
46
45
else
47
- new_password=" ${args[2 ]} "
46
+ new_password=" ${args[1 ]} "
48
47
fi
49
48
/usr/bin/psql " ${connection[@]} " -c " CREATE ROLE ${new_user} WITH LOGIN PASSWORD '${new_password} ';"
50
49
else
70
69
# shellcheck disable=SC2034
71
70
dbname=" ${new_user} "
72
71
connection=()
73
- for item in host port user dbname; do
72
+ for item in host port username dbname; do
74
73
if [[ -n " ${! item:- } " ]]; then
75
- connection+=(" --${item} " " ${! item} " )
74
+ connection+=(" --${item} = ${! item} " )
76
75
fi
77
76
done
78
77
You can’t perform that action at this time.
0 commit comments