Skip to content

Commit

Permalink
* Use the db env variables when setting up the database.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgroff committed Aug 9, 2018
1 parent f267557 commit 541c7dc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions deploy/provision/dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
apt install -y postgresql

# Create the database, check if the role and database exist first though.
if ! sudo -u postgres -- psql -tAc "SELECT 1 FROM pg_roles WHERE rolname='kala'" | grep -q 1; then
sudo -u postgres -- psql -c "CREATE ROLE kala WITH LOGIN PASSWORD 'kala';"
if ! sudo -u postgres -- psql -tAc "SELECT 1 FROM pg_roles WHERE rolname='$DATABASE_USER'" | grep -q 1; then
sudo -u postgres -- psql -c "CREATE ROLE $DATABASE_USER WITH LOGIN PASSWORD '$DATABASE_PASSWORD';"
fi

if ! sudo -u postgres -- psql -tAc "SELECT 1 from pg_database WHERE datname='kala'" | grep -q 1; then
sudo -u postgres -- psql -c "CREATE DATABASE kala WITH OWNER kala;"
if ! sudo -u postgres -- psql -tAc "SELECT 1 from pg_database WHERE datname='$DATABASE_NAME'" | grep -q 1; then
sudo -u postgres -- psql -c "CREATE DATABASE $DATABASE_NAME WITH OWNER $DATABASE_USER;"
fi

# Load Data
Expand Down

0 comments on commit 541c7dc

Please sign in to comment.