Commit dfd23efb authored by Raphael Beer's avatar Raphael Beer

Add: install and startup script; read runtime config from .env.* files

parent ace9d1e1
ACCOUNT_FILE=./.htaccounts
LOG_FILE=./logs/results.log
DEBUG_FILE=./logs/debug.log
PORT=4040
MONGO_HOST=127.0.0.1
MONGO_PORT=27017
MONGO_DB=tester
MONGO_RESULTS_COLLECTION=results
MONGO_OVERSHOT_COLLECTION=overshot
......@@ -52,4 +52,5 @@ node_modules
# .env
.env
.env.*
!.env.example
.ht*
#!/usr/bin/env bash
echo -n "Looking for Python3: "
if ! hash python3; then
echo -n "\nPlease install Python3 to use this program!"
fi
echo "OK"
echo "Installing dependencies..."
pip3 install -r requirements.txt --no-cache-dir
echo -e "\n----------------------------"
echo "All done! \o/"
echo "Run 'PYTON_ENV=[development|prodcution] ./run.sh' to start the server!"
if [ "$PYTHON_ENV" != 'production' ] && [ "$PYTHON_ENV" != 'development' ]; then
echo "Please provide a PYTHON_ENV value of 'production' or 'development'"
echo "e.g. $ PYTHON_ENV=development $0"
exit
fi
EXPECTED_ENV_FILE="./.env.$PYTHON_ENV"
if [ ! -f $EXPECTED_ENV_FILE ]; then
echo "Please provide a configuration file {$EXPECTED_ENV_FILE}!"
fi
echo "Using configuration from: $EXPECTED_ENV_FILE"
source $EXPECTED_ENV_FILE
echo "Starting server..."
python3 ./backend.py \
--account-file $ACCOUNT_FILE \
--log $LOG_FILE \
--debug $DEBUG_FILE \
--port "$PORT" \
--mongo-host $MONGO_HOST \
--mongo-port $MONGO_PORT \
--mongo-db $MONGO_DB
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment