2020-10-08 10:34:02 +00:00
|
|
|
#!/bin/bash
|
2022-06-28 10:30:02 +00:00
|
|
|
|
2020-11-19 11:29:40 +00:00
|
|
|
source venv/bin/activate
|
2022-06-28 10:30:02 +00:00
|
|
|
|
|
|
|
display_help() {
|
|
|
|
local script_name=$(basename "${0}")
|
|
|
|
echo ""
|
|
|
|
echo "Usage: ${script_name} [COMMAND]"
|
|
|
|
echo ""
|
|
|
|
echo "Run wrapper for a nopaque instance"
|
|
|
|
echo ""
|
|
|
|
echo "Commands:"
|
|
|
|
echo " flask A general utility script for Flask applications."
|
|
|
|
echo ""
|
|
|
|
echo "Run '${script_name} COMMAND --help' for more information on a command."
|
|
|
|
}
|
|
|
|
|
2020-11-13 14:01:53 +00:00
|
|
|
if [[ "${#}" -eq 0 ]]; then
|
2022-04-22 14:36:12 +00:00
|
|
|
if [[ "${NOPAQUE_IS_PRIMARY_INSTANCE:-True}" == "True" ]]; then
|
|
|
|
while true; do
|
|
|
|
flask deploy
|
|
|
|
if [[ "${?}" == "0" ]]; then
|
|
|
|
break
|
|
|
|
fi
|
2022-06-28 10:30:02 +00:00
|
|
|
echo "Deploy command failed, retrying in 5 secs..."
|
2022-04-22 14:36:12 +00:00
|
|
|
sleep 5
|
|
|
|
done
|
2021-09-22 11:53:39 +00:00
|
|
|
fi
|
2022-04-22 14:36:12 +00:00
|
|
|
python nopaque.py
|
2020-11-13 14:01:53 +00:00
|
|
|
elif [[ "${1}" == "flask" ]]; then
|
2022-06-28 10:30:02 +00:00
|
|
|
flask "${@:2}"
|
|
|
|
elif [[ "${1}" == "--help" || "${1}" == "-h" ]]; then
|
|
|
|
display_help
|
2020-10-08 10:34:02 +00:00
|
|
|
else
|
2022-06-28 10:30:02 +00:00
|
|
|
display_help
|
|
|
|
exit 1
|
2020-10-08 10:34:02 +00:00
|
|
|
fi
|