#!/bin/dash

PROGRAM=validator-daemon

BIN_DIR=$(dirname $0)
LOCAL_CONFIG=$BIN_DIR/$PROGRAM.$ENV_TYPE.properties
GLOBAL_CONFIG=$BIN_DIR/$PROGRAM.$ENV_TYPE.properties
RUN_DIR=$BIN_DIR
LOG_DIR=/place/db/www/logs

LoadConfig() {
    for line in `cat $1 | awk -F'=' -v OFS='=' '{ gsub(/\./, "_", $1); print}'`; do
        eval "$line"
    done;
}

LoadConfig $GLOBAL_CONFIG

cd $RUN_DIR
exec $BIN_DIR/$PROGRAM -G $GLOBAL_CONFIG -C $LOCAL_CONFIG -L $LOG_DIR/current-webmaster-$PROGRAM-$IPORT $*
