Created
October 19, 2018 13:07
-
-
Save artrey/272b0effe0cd7f6de86ac8d1948040cc to your computer and use it in GitHub Desktop.
Configuring postgres database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
DB_USER=${DB_USER:-"default_user"} | |
DB_PASSWORD=${DB_PASSWORD:-"default_password"} | |
DB_NAME=${DB_NAME:-"default_name"} | |
sudo -u postgres psql -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASSWORD';" | |
sudo -u postgres psql -c "CREATE DATABASE $DB_NAME;" | |
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment