entrypoint.sh 567 B

12345678910111213141516171819202122
  1. #!/bin/bash
  2. export PYTHONPATH=$PYTHONPATH:.
  3. export WEBAPP_PIDFILE="/run/scriptshifter_webapp.pid"
  4. export FLASK_APP="scriptshifter.rest_api"
  5. if [ "${TXL_APP_MODE}" == "development" ]; then
  6. export FLASK_ENV="development"
  7. else
  8. export FLASK_ENV="production"
  9. fi
  10. # Preload Thai model.
  11. python -c 'from esupar import load; load("th")'
  12. host=${TXL_WEBAPP_HOST:-"0.0.0.0"}
  13. port=${TXL_WEBAPP_PORT:-"8000"}
  14. if [ "${FLASK_ENV}" == "development" ]; then
  15. exec flask run -h $host -p $port
  16. else
  17. exec uwsgi --uid www --ini ./uwsgi.ini --http "${host}:${port}" $@
  18. fi