#!/bin/bash
#
# This script is designed to be run inside the container
#
PATH=$PATH:/usr/lib/postgresql/9.3/bin

# provide defaults for required envvars
PG_CONFIG=${PG_CONFIG:-/etc/postgresql/9.3/main/postgresql.conf}
PG_LISTEN=${PG_LISTEN:-*}

# run the service in the foreground
sudo -i -u postgres /usr/lib/postgresql/9.3/bin/postgres \
                    -c config-file=$PG_CONFIG \
                    -c listen-addresses=$PG_LISTEN
