Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b48e45b

Browse filesBrowse files
committed
Fixes to create-user-db
1 parent c24194b commit b48e45b
Copy full SHA for b48e45b

File tree

Expand file treeCollapse file tree

1 file changed

+4
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-5
lines changed

‎commands/create-user-db

Copy file name to clipboardExpand all lines: commands/create-user-db
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff 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

3938
echoerr ">>> 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}';"
5049
else
@@ -70,9 +69,9 @@ else
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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.