#!/bin/sh

set -e

psql -v ON_ERROR_STOP=1 \
     --username "$POSTGRES_USER" \
     --dbname "$POSTGRES_DB" <<END
    CREATE USER $POSTGRES_RB_USER WITH PASSWORD '$POSTGRES_RB_PASSWORD';
    GRANT ALL PRIVILEGES ON DATABASE $POSTGRES_DB TO $POSTGRES_RB_USER;
END
