#!/bin/bash set -e set -x # This file loads the database dump into the postgres database dump_path="/mnt/host_data/postgres_data.dmp" #Double check the postgres user and database are set if [[ -z $POSTGRES_USER && -z $POSTGRES_DB ]]; #if either POSTGRES_USER or POSTGRES_DB are empty, throw an error. then echo "Missing either the POSTGRESS_USER or the POSTGRES_DB environment variable" exit 4 else #restore the DB pg_restore -e -v -O -x --dbname="$POSTGRES_DB" --username="$POSTGRES_USER" --no-owner "$dump_path" fi