kych

OAuth 2.0 API for Swiyu to enable Taler integration of Swiyu for KYC (experimental)
Log | Files | Refs | Submodules | README | LICENSE

install_db.sh (933B)


      1 #!/bin/bash
      2 # Create the development database for the SWIYU verifier.
      3 #
      4 # The schema itself is not created here: the verifier runs its own Flyway
      5 # migrations on every start.  Only the role and the database are needed, and
      6 # the role needs a password because the PostgreSQL JDBC driver cannot use peer
      7 # authentication over a Unix socket.
      8 #
      9 # The values match application-kych.yml.template; override them in the
     10 # environment if your PostgreSQL is elsewhere.
     11 set -eu
     12 
     13 DB_HOST=${DB_HOST:-localhost}
     14 DB_PORT=${DB_PORT:-5432}
     15 DB_NAME=${DB_NAME:-verifier_db}
     16 DB_USER=${DB_USER:-verifier_user}
     17 DB_PASS=${DB_PASS:-secret}
     18 
     19 export PGHOST="$DB_HOST"
     20 export PGPORT="$DB_PORT"
     21 
     22 psql -d postgres -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS';"
     23 psql -d postgres -c "CREATE DATABASE $DB_NAME OWNER $DB_USER;"
     24 
     25 echo "Created database '$DB_NAME' owned by '$DB_USER' on $DB_HOST:$DB_PORT."
     26 echo "The verifier creates its schema on first start."