2023-09-29 20:00:16 +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}."
|
2023-09-29 20:00:16 +00:00
|
|
|
exit "$2"
|
|
|
|
}
|
|
|
|
trap 'error_handler ${LINENO} $?' ERR
|
|
|
|
set -o errtrace -o errexit -o nounset -o pipefail
|
|
|
|
|
|
|
|
if [ "${BASH_SOURCE[0]}" -ef "$0" ]; then
|
|
|
|
echo "Hey, you should source this script, not execute it!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-06-13 17:34:32 +00:00
|
|
|
PORT="${SPIFFWORKFLOW_BACKEND_PORT:-7000}"
|
2024-05-24 23:06:16 +00:00
|
|
|
use_local_open_id="false"
|
|
|
|
acceptance_test_mode="false"
|
|
|
|
|
|
|
|
arg_1="${1:-}"
|
|
|
|
|
|
|
|
if [[ "$arg_1" == "localopenid" ]]; then
|
|
|
|
use_local_open_id="true"
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
if [[ "$arg_1" == "acceptance" ]]; then
|
|
|
|
acceptance_test_mode="true"
|
|
|
|
shift
|
|
|
|
fi
|
2023-09-29 20:00:16 +00:00
|
|
|
|
|
|
|
process_model_dir="${1:-}"
|
2023-12-05 16:41:59 +00:00
|
|
|
if [[ -d "$process_model_dir" ]]; then
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
2023-09-29 20:00:16 +00:00
|
|
|
if [[ -z "${SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR:-}" ]]; then
|
|
|
|
if [[ -n "${process_model_dir}" ]] && [[ -d "${process_model_dir}" ]]; then
|
|
|
|
SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR="$process_model_dir"
|
|
|
|
else
|
|
|
|
SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR=$(./bin/find_sample_process_models)
|
|
|
|
fi
|
|
|
|
export SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR
|
|
|
|
fi
|
|
|
|
|
2024-05-24 23:06:16 +00:00
|
|
|
if [[ "$acceptance_test_mode" == "true" ]]; then
|
2023-09-29 20:00:16 +00:00
|
|
|
export SPIFFWORKFLOW_BACKEND_LOAD_FIXTURE_DATA=true
|
|
|
|
export SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME=acceptance_tests.yml
|
2024-05-24 23:06:16 +00:00
|
|
|
elif [[ "$use_local_open_id" == "true" ]]; then
|
2024-05-13 23:56:37 +00:00
|
|
|
backend_base_url="${SPIFFWORKFLOW_BACKEND_URL:-}"
|
2024-04-08 15:50:55 +00:00
|
|
|
if [[ -z "$backend_base_url" ]]; then
|
2024-06-13 17:34:32 +00:00
|
|
|
backend_base_url="http://localhost:$PORT"
|
2024-04-08 15:50:55 +00:00
|
|
|
fi
|
2024-01-16 19:47:25 +00:00
|
|
|
export SPIFFWORKFLOW_BACKEND_AUTH_CONFIGS__0__identifier="default"
|
2024-01-29 14:40:39 +00:00
|
|
|
export SPIFFWORKFLOW_BACKEND_AUTH_CONFIGS__0__label="internal openid"
|
2024-04-08 15:50:55 +00:00
|
|
|
export SPIFFWORKFLOW_BACKEND_AUTH_CONFIGS__0__uri="${backend_base_url}/openid"
|
2023-11-09 15:34:07 +00:00
|
|
|
export SPIFFWORKFLOW_BACKEND_AUTH_CONFIGS__0__client_id="spiffworkflow-backend"
|
|
|
|
export SPIFFWORKFLOW_BACKEND_AUTH_CONFIGS__0__client_secret="JXeQExm0JhQPLumgHtIIqf52bDalHz0q"
|
2023-09-29 20:00:16 +00:00
|
|
|
export SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME="example.yml"
|
2023-11-09 15:34:07 +00:00
|
|
|
|
2023-11-09 16:09:11 +00:00
|
|
|
# else # uncomment to test multiple auths
|
|
|
|
# export SPIFFWORKFLOW_BACKEND_AUTH_CONFIGS__0__identifier="keycloak_internal"
|
|
|
|
# export SPIFFWORKFLOW_BACKEND_AUTH_CONFIGS__0__label="I am a Core Contributor"
|
|
|
|
# export SPIFFWORKFLOW_BACKEND_AUTH_CONFIGS__0__uri="http://localhost:7002/realms/spiffworkflow"
|
|
|
|
# export SPIFFWORKFLOW_BACKEND_AUTH_CONFIGS__0__client_id="spiffworkflow-backend"
|
|
|
|
# export SPIFFWORKFLOW_BACKEND_AUTH_CONFIGS__0__client_secret="JXeQExm0JhQPLumgHtIIqf52bDalHz0q"
|
|
|
|
#
|
|
|
|
# export SPIFFWORKFLOW_BACKEND_AUTH_CONFIGS__1__identifier="openid"
|
|
|
|
# export SPIFFWORKFLOW_BACKEND_AUTH_CONFIGS__1__label="I am a vendor"
|
2024-06-13 17:34:32 +00:00
|
|
|
# export SPIFFWORKFLOW_BACKEND_AUTH_CONFIGS__1__uri="http://localhost:$PORT/openid"
|
2023-11-09 16:09:11 +00:00
|
|
|
# export SPIFFWORKFLOW_BACKEND_AUTH_CONFIGS__1__client_id="spiffworkflow-backend"
|
|
|
|
# export SPIFFWORKFLOW_BACKEND_AUTH_CONFIGS__1__client_secret="JXeQExm0JhQPLumgHtIIqf52bDalHz0q"
|
|
|
|
|
|
|
|
# else # uncomment to test specfied
|
|
|
|
# export SPIFFWORKFLOW_BACKEND_OPEN_ID_SERVER_URL="http://localhost:7002/realms/spiffworkflow"
|
|
|
|
# export SPIFFWORKFLOW_BACKEND_OPEN_ID_CLIENT_ID="spiffworkflow-backend"
|
|
|
|
# export SPIFFWORKFLOW_BACKEND_OPEN_ID_CLIENT_SECRET_KEY="JXeQExm0JhQPLumgHtIIqf52bDalHz0q"
|
|
|
|
|
2023-09-29 20:00:16 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "${SPIFFWORKFLOW_BACKEND_ENV:-}" ]]; then
|
|
|
|
export SPIFFWORKFLOW_BACKEND_ENV=local_development
|
|
|
|
fi
|
|
|
|
|
|
|
|
export FLASK_SESSION_SECRET_KEY="e7711a3ba96c46c68e084a86952de16f"
|
2024-04-09 17:44:47 +00:00
|
|
|
export FLASK_DEBUG=1
|
2023-09-29 20:00:16 +00:00
|
|
|
|
|
|
|
if [[ -z "${SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER_IN_CREATE_APP:-}" ]]; then
|
|
|
|
SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER_IN_CREATE_APP=true
|
|
|
|
fi
|
|
|
|
export SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER_IN_CREATE_APP
|
|
|
|
|
|
|
|
export FLASK_APP=src/spiffworkflow_backend
|
2024-05-03 14:09:32 +00:00
|
|
|
|
|
|
|
if [[ -z "${SPIFFWORKFLOW_BACKEND_FAIL_ON_INVALID_PROCESS_MODELS:-}" ]]; then
|
|
|
|
export SPIFFWORKFLOW_BACKEND_FAIL_ON_INVALID_PROCESS_MODELS=false
|
|
|
|
fi
|