Skip to content

Commit bbbee46

Browse files
authored
Merge pull request #153 from openbase/fix_bco_option_handling_in_docker_entry_point
fix entry point multi argument handling for docker.
2 parents 3221e95 + eacf915 commit bbbee46

3 files changed

Lines changed: 19 additions & 6 deletions

File tree

docker/docker-entrypoint.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,24 @@ if [ -z ${BCO_MODULE_PREPARE_SCRIPT+x} ]; then
1515
echo "no module preperation required.";
1616
else
1717
echo "prepare bco modules...";
18-
source /usr/local/bin/${BCO_MODULE_PREPARE_SCRIPT};
18+
# shellcheck disable=SC1090 # source a dynamic script path intentionally
19+
source /usr/local/bin/"${BCO_MODULE_PREPARE_SCRIPT}";
1920
fi
2021

2122
# replace the current pid 1 with original entrypoint
22-
echo "start main application: $@"
23+
# Use printf to safely print all positional args without mixing scalar and array expansions
24+
printf 'start main application: %s\n' "$*"
2325

24-
set -- "$@" --bco-home "${BCO_HOME}" --log-dir "${BCO_LOGS}" --host "${MQTT_BROKER}" "${BCO_OPTIONS}"
26+
# If BCO_OPTIONS contains multiple space-separated arguments, expand them as distinct
27+
# arguments by splitting into a bash array. This avoids passing the entire string as
28+
# a single argument when using "${BCO_OPTIONS}".
29+
_bco_options_array=()
30+
if [ -n "${BCO_OPTIONS:-}" ]; then
31+
# read -a splits on IFS (whitespace), preserving each option as a separate element
32+
# Note: if options themselves need to contain spaces, provide them via an array env
33+
# or a different mechanism; this simple split handles the common case of multiple flags.
34+
read -r -a _bco_options_array <<< "${BCO_OPTIONS}"
35+
fi
36+
37+
set -- "$@" --bco-home "${BCO_HOME}" --log-dir "${BCO_LOGS}" --host "${MQTT_BROKER}" "${_bco_options_array[@]}"
2538
exec "$@"

versions.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ version.org.openbase..jul.communication.mqtt.test=3.7.2
7676

7777
version.org.openbase..jul.transformation=3.7.2
7878

79-
version.org.testcontainers..junit-jupiter=1.18.3
79+
version.org.testcontainers..junit-jupiter=1.21.4
8080

81-
version.org.testcontainers..testcontainers=1.18.3
81+
version.org.testcontainers..testcontainers=2.0.3
8282

8383
version.org.springframework.boot..spring-boot-starter-webflux=3.1.2
8484

0 commit comments

Comments
 (0)