@@ -4,7 +4,7 @@ database_drop_user ()
44{
55 heading " Dropping Database User..."
66
7- sudo -u postgres dropuser --if-exists " $ARK_DB_USERNAME " | tee -a " $commander_log "
7+ sudo -u postgres dropuser --if-exists " ${ ARK_DB_USERNAME} " | tee -a " $commander_log "
88
99 success " Dropped Database User!"
1010}
@@ -13,7 +13,7 @@ database_destroy ()
1313{
1414 heading " Destroying Database..."
1515
16- sudo -u postgres dropdb --if-exists " $ARK_DB_DATABASE " | tee -a " $commander_log "
16+ sudo -u postgres dropdb --if-exists " ${ ARK_DB_DATABASE} " | tee -a " $commander_log "
1717
1818 success " Destroyed Database!"
1919}
@@ -26,17 +26,17 @@ database_create ()
2626
2727 wait_to_continue
2828
29- local userExists=$( sudo -u postgres psql -c " SELECT * FROM pg_user WHERE usename = '$USER '" | grep -c " 1 row" )
29+ local userExists=$( sudo -u postgres psql -c " SELECT * FROM pg_user WHERE username = '${ARK_DB_USERNAME} '" | grep -c " 1 row" )
3030
3131 if [[ $userExists == 1 ]]; then
32- read -p " The database user ${USER } already exists, do you want to overwrite it? [y/N] : " choice
32+ read -p " The database user ${ARK_DB_USERNAME } already exists, do you want to overwrite it? [y/N] : " choice
3333
3434 if [[ " $choice " =~ ^(yes| y| Y) ]]; then
35- sudo -u postgres psql -c " DROP USER $USER " | tee -a " $commander_log "
36- sudo -u postgres psql -c " CREATE USER $USER WITH PASSWORD 'password ' CREATEDB;" | tee -a " $commander_log "
35+ sudo -u postgres psql -c " DROP USER ${ARK_DB_USERNAME} " | tee -a " $commander_log "
36+ sudo -u postgres psql -c " CREATE USER ${ARK_DB_USERNAME} WITH PASSWORD '${ARK_DB_PASSWORD} ' CREATEDB;" | tee -a " $commander_log "
3737 fi
3838 else
39- sudo -u postgres psql -c " CREATE USER $USER WITH PASSWORD 'password ' CREATEDB;" | tee -a " $commander_log "
39+ sudo -u postgres psql -c " CREATE USER ${ARK_DB_USERNAME} WITH PASSWORD '${ARK_DB_PASSWORD} ' CREATEDB;" | tee -a " $commander_log "
4040 fi
4141
4242 local databaseExists=$( psql -l | grep " ${ARK_DB_DATABASE} " | wc -l)
0 commit comments