#! /bin/sh

# Configure postgresql in a docker instance.

/bin/su postgres -c '/usr/lib/postgresql/9.1/bin/postgres --single -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf' <<EOF
alter role postgres with encrypted password '@@POSTGRES_ROOT_PW@@';

create user @@ARVADOS_DEV_USER@@ with encrypted password '@@ARVADOS_DEV_PW@@';
create database @@ARVADOS_DEV_DB@@ with owner @@ARVADOS_DEV_USER@@;

create user @@ARVADOS_TEST_USER@@ with createdb encrypted password '@@ARVADOS_TEST_PW@@';

create user @@ARVADOS_PROD_USER@@ with encrypted password '@@ARVADOS_PROD_PW@@';
create database @@ARVADOS_PROD_DB@@ with owner @@ARVADOS_PROD_USER@@;
EOF