Repository navigation
Expand file tree
/
Copy pathoperaton-operaton.sh
More file actions
executable file
·84 lines (69 loc) · 2.8 KB
/
Copy pathoperaton-operaton.sh
File metadata and controls
executable file
·84 lines (69 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
set -Eeu
trap 'Error on line $LINENO' ERR
source $(dirname "$0")/operaton-lib.sh
# Set Password as Docker Secrets for Swarm-Mode
if [[ -z "${DB_PASSWORD:-}" && -n "${DB_PASSWORD_FILE:-}" && -f "${DB_PASSWORD_FILE:-}" ]]; then
export DB_PASSWORD="$(< "${DB_PASSWORD_FILE}")"
fi
# For compatibility: when DB_ variables are set, translate them to SPRING_ variables.
# Otherwise [defaults](https://github.com/operaton/operaton-bpm-platform/blob/master/distro/run/assembly/resources/default.yml)
# will be used.
if [[ -z "${SPRING_DATASOURCE_DRIVER_CLASS_NAME:-}" && -n "${DB_DRIVER:-}" ]]; then
export SPRING_DATASOURCE_DRIVER_CLASS_NAME="${DB_DRIVER}"
fi
if [[ -z "${SPRING_DATASOURCE_PASSWORD:-}" && -n "${DB_PASSWORD:-}" ]]; then
export SPRING_DATASOURCE_PASSWORD="${DB_PASSWORD}"
fi
if [[ -z "${SPRING_DATASOURCE_USERNAME:-}" && -n "${DB_USERNAME:-}" ]]; then
export SPRING_DATASOURCE_USERNAME="${DB_USERNAME}"
fi
if [[ -z "${SPRING_DATASOURCE_URL:-}" && -n "${DB_URL:-}" ]]; then
export SPRING_DATASOURCE_URL="${DB_URL}"
fi
SWAGGERUI_PATH=/operaton/internal/swaggerui/
# The start script of the distribution (internal/run.sh) does not know --swaggerui, so it is handled here and not passed on.
# Without explicitly chosen components, run.sh enables the REST API and the web apps; Swagger UI is
# enabled as well then, except in production mode.
componentChosen=false
restChosen=false
swaggeruiChosen=false
productionChosen=false
args=()
for arg in "$@"; do
case "$arg" in
--swaggerui ) swaggeruiChosen=true
continue
;;
--rest | --webapps-neo ) componentChosen=true
restChosen=true
;;
--webapps | --oauth2 | --example ) componentChosen=true
;;
--production ) productionChosen=true
;;
--help ) /operaton/internal/run.sh start --help
echo " --swaggerui - Enables the Swagger UI at /swaggerui/index.html (provided by the Docker image)"
exit 0
;;
esac
args+=("$arg")
done
if [[ "$componentChosen" = "false" ]]; then
restChosen=true
if [[ "$productionChosen" = "false" ]]; then
swaggeruiChosen=true
fi
fi
if [[ "$swaggeruiChosen" = "true" ]]; then
echo "Swagger UI enabled"
if [[ "$restChosen" = "false" ]]; then
echo "You did not enable the REST API. Swagger UI will not be able to send any requests to this Operaton instance."
fi
# Static resources are disabled in the default configuration, so expose only the Swagger UI directory
export SPRING_WEB_RESOURCES_STATIC_LOCATIONS="${SPRING_WEB_RESOURCES_STATIC_LOCATIONS:+${SPRING_WEB_RESOURCES_STATIC_LOCATIONS},}file:${SWAGGERUI_PATH}"
fi
CMD="/operaton/internal/run.sh start"
wait_for_it
# shellcheck disable=SC2086
exec ${CMD} "${args[@]}"