#!/bin/bash

if [[ $DAD_ENVIRONMENT == "development" ]]; then
    /web_apps/dad/dad run --host=0.0.0.0
elif [[ $DAD_ENVIRONMENT == "production" || $DAD_ENVIRONMENT == "test" ]]; then
    export PYTHONWARNINGS=ignore
    /usr/bin/uwsgi --plugin python36,http \
        --http 0.0.0.0:5000 \
        --chdir /web_apps/dad/dad.runfiles/zoox \
        --wsgi-file web_apps/dad/app \
        --http-timeout 3600 \
        --pythonpath /web_apps/dad/dad.runfiles/zoox/web_apps \
        --pythonpath /web_apps/dad/dad.runfiles/zoox/web_apps/dad \
        --pythonpath /web_apps/dad/dad.runfiles/pypi__\* \
        --processes 4 \
        --threads 4
else
    echo "Invalid environment DAD_ENVIRONMENT=$DAD_ENVIRONMENT . Possible environments are development, test and production"
    exit 1
fi

