2022-10-12 14:22:22 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
function error_handler() {
|
2024-01-16 19:47:25 +00:00
|
|
|
echo >&2 "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
|
2022-10-12 14:22:22 +00:00
|
|
|
exit "$2"
|
|
|
|
}
|
|
|
|
trap 'error_handler ${LINENO} $?' ERR
|
|
|
|
set -o errtrace -o errexit -o nounset -o pipefail
|
|
|
|
|
2024-01-16 19:47:25 +00:00
|
|
|
script_dir="$(
|
|
|
|
cd -- "$(dirname "$0")" >/dev/null 2>&1
|
|
|
|
pwd -P
|
|
|
|
)"
|
2023-09-29 20:00:16 +00:00
|
|
|
. "${script_dir}/local_development_environment_setup"
|
2022-10-12 14:22:22 +00:00
|
|
|
|
2023-12-05 16:41:59 +00:00
|
|
|
server_type="${1:-api}"
|
|
|
|
|
|
|
|
if [[ "$server_type" == "celery_worker" ]]; then
|
|
|
|
"${script_dir}/start_celery_worker"
|
2022-10-12 14:22:22 +00:00
|
|
|
else
|
2023-12-05 16:41:59 +00:00
|
|
|
if [[ -n "${SPIFFWORKFLOW_BACKEND_LOAD_FIXTURE_DATA:-}" ]]; then
|
|
|
|
./bin/boot_server_in_docker
|
|
|
|
else
|
|
|
|
export FLASK_DEBUG=1
|
2022-10-12 19:28:52 +00:00
|
|
|
|
2023-12-05 16:41:59 +00:00
|
|
|
if [[ "${SPIFFWORKFLOW_BACKEND_RUN_DATA_SETUP:-}" != "false" ]]; then
|
|
|
|
SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER_IN_CREATE_APP=false SPIFFWORKFLOW_BACKEND_FAIL_ON_INVALID_PROCESS_MODELS=false poetry run python bin/save_all_bpmn.py
|
|
|
|
fi
|
2023-01-17 17:23:51 +00:00
|
|
|
|
2024-01-16 19:47:25 +00:00
|
|
|
# this line blocks
|
|
|
|
poetry run flask run -p "$port" --host=0.0.0.0
|
2023-12-05 16:41:59 +00:00
|
|
|
fi
|
2022-10-12 14:22:22 +00:00
|
|
|
fi
|