summaryrefslogtreecommitdiff
path: root/postgres/bootstrap.sh
diff options
context:
space:
mode:
Diffstat (limited to 'postgres/bootstrap.sh')
-rw-r--r--postgres/bootstrap.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/postgres/bootstrap.sh b/postgres/bootstrap.sh
index 391aeab..070e104 100644
--- a/postgres/bootstrap.sh
+++ b/postgres/bootstrap.sh
@@ -10,8 +10,12 @@ apt-get install -y xauth
apt-get install -y postgresql postgresql-client pgadmin3
# set up db
-sudo -u postgres psql -c "CREATE USER space WITH PASSWORD 'space';"
-sudo -u postgres psql -c "CREATE DATABASE space_db WITH OWNER space;"
+USERNAME=$(grep POSTGRES_USERNAME /vagrant/src/constants.rs | cut -d '"' -f2)
+PASSWORD=$(grep POSTGRES_PASSWORD /vagrant/src/constants.rs | cut -d '"' -f2)
+DB_NAME=$(grep POSTGRES_DB_NAME /vagrant/src/constants.rs | cut -d '"' -f2)
+
+sudo -u postgres psql -c "CREATE USER $USERNAME WITH PASSWORD '$PASSWORD';"
+sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $USERNAME;"
# copy configs
cp /vagrant/postgres/*conf /etc/postgresql/9.6/main/