#!/bin/sh

MYSQL_DATABASE=$1
MYSQL_USER=$2
MYSQL_PASSWORD=$3

echo Configuring Unite DB: $MYSQL_DATABASE, $MYSQL_USER, $MYSQL_PASSWORD

REPLACE_MYSQL_DATABASE="s/MYSQL_DATABASE/$MYSQL_DATABASE/g"
REPLACE_MYSQL_USER="s/MYSQL_USER/$MYSQL_USER/g"
REPLACE_MYSQL_PASSWORD="s/MYSQL_PASSWORD/$MYSQL_PASSWORD/g"

cat /app/www/joomla-unite.tmp | \
	sed $REPLACE_MYSQL_DATABASE | \
	sed $REPLACE_MYSQL_USER | \
    sed $REPLACE_MYSQL_PASSWORD \
    > /app/www/joomla-unite.xml

rm /app/www/joomla-unite.tmp