Better assertions and error messages in Mongoose/run.sh

Former-commit-id: 9da7587d20
This commit is contained in:
Jérôme Schneider 2012-03-22 14:05:36 +01:00
parent 8ee030f4cf
commit 3d8524a782
2 changed files with 12 additions and 4 deletions

0
CoreVersions/Baikal_0.1/Bootstrap.php Normal file → Executable file
View file

View file

@ -30,18 +30,26 @@ function whichBINDIST() {
} }
function getBaikalConf() { function getBaikalConf() {
local CONF=$(php -r "require_once('$PATH_CONFIGFILE'); if(is_bool($1)) { echo intval($1);} else { echo $1;}") local CONF=$(php -r "require_once('$PATH_CONFIGFILE'); if(!defined(\"$1\")) { echo null; exit;} if(is_bool($1)) { echo intval($1); exit;} else { echo $1; exit;}")
echo "$CONF" echo "$CONF"
} }
BAIKAL_STANDALONE_ALLOWED=$(getBaikalConf BAIKAL_STANDALONE_ALLOWED) BAIKAL_STANDALONE_ALLOWED=$(getBaikalConf BAIKAL_STANDALONE_ALLOWED)
if [[ "$BAIKAL_STANDALONE_ALLOWED" == '0' ]]; then if [[ "$BAIKAL_STANDALONE_ALLOWED" == '0' ]]; then
echo "Baïkal Standalone Server is disabled by config." echo "Baïkal Standalone Server is disallowed by config. To allow it, please set BAIKAL_STANDALONE_ALLOWED to TRUE in Specific/config.php"
exit 0 echo "-- Aborting; Baïkal Standalone Server is not running --"
exit 1
fi fi
BAIKAL_STANDALONE_PORT=$(getBaikalConf BAIKAL_STANDALONE_PORT)
MONGOOSE_BINDIST=$(whichBINDIST) MONGOOSE_BINDIST=$(whichBINDIST)
BAIKAL_STANDALONE_PORT=$(getBaikalConf BAIKAL_STANDALONE_PORT)
if [[ "$BAIKAL_STANDALONE_PORT" == "" ]]; then
echo "No port number is defined for Baïkal Standalone Server to listen on. Please set BAIKAL_STANDALONE_PORT to the desired portnumber in Specific/config.php;"
echo "-- Aborting; Baïkal Standalone Server is not running --"
exit 1
fi
echo "Serving standalone Baïkal on port $BAIKAL_STANDALONE_PORT ('$PATH_DOCROOT' on $MONGOOSE_BINDIST)" echo "Serving standalone Baïkal on port $BAIKAL_STANDALONE_PORT ('$PATH_DOCROOT' on $MONGOOSE_BINDIST)"
MONGOOSE_BIN="$MONGOOSE_BUILDS""$MONGOOSE_BINDIST""/mongoose" MONGOOSE_BIN="$MONGOOSE_BUILDS""$MONGOOSE_BINDIST""/mongoose"