Skip to content

Commit 7e7cc24

Browse files
Merge pull request #114 from iNecas/fix-start-console
fix: invalid proxy config in start-console.sh
2 parents cff85f5 + b84651f commit 7e7cc24

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

scripts/start-console.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,32 @@ echo "Console Image: $CONSOLE_IMAGE"
3030
echo "Console URL: http://localhost:${CONSOLE_PORT}"
3131
echo "Console Platform: $CONSOLE_IMAGE_PLATFORM"
3232

33+
34+
function bridge_vars_env {
35+
# Originally, (set | grep BRIDGE) was used, but it doesn't escape BRIDGE_PLUGIN_PROXY properly.
36+
# We use "${!var}" to get the variable value by dynamic name.
37+
for var in $(set | grep ^BRIDGE | sed 's/=.*//'); do
38+
printf "%s=%s\n" "$var" "${!var}"
39+
done
40+
}
41+
3342
# Prefer podman if installed. Otherwise, fall back to docker.
3443
if [ -x "$(command -v podman)" ]; then
3544
if [ "$(uname -s)" = "Linux" ]; then
3645
# Use host networking on Linux since host.containers.internal is unreachable in some environments.
3746
BRIDGE_PLUGINS="troubleshooting-panel-console-plugin=http://localhost:9002,monitoring-plugin=http://localhost:9001"
3847
BRIDGE_PLUGIN_PROXY="{\"services\": [{\"consoleAPIPath\": \"/api/proxy/plugin/${npm_package_consolePlugin_name}/korrel8r/\", \"endpoint\":\"https://localhost:9005\",\"authorize\":true}]}"
39-
podman run --pull always --platform $CONSOLE_IMAGE_PLATFORM --rm --network=host --env-file <(set | grep BRIDGE) $CONSOLE_IMAGE
48+
podman run --pull always --platform $CONSOLE_IMAGE_PLATFORM --rm --network=host --env-file <(bridge_vars_env) $CONSOLE_IMAGE
4049
else
4150
BRIDGE_PLUGINS="troubleshooting-panel-console-plugin=http://host.containers.internal:9002,monitoring-plugin=http://host.containers.internal:9001"
4251
BRIDGE_PLUGIN_PROXY="{\"services\": [{\"consoleAPIPath\": \"/api/proxy/plugin/${npm_package_consolePlugin_name}/korrel8r/\", \"endpoint\":\"https://host.containers.internal:9005\",\"authorize\":true}]}"
4352
podman run --pull always --platform $CONSOLE_IMAGE_PLATFORM \
4453
--rm -p "$CONSOLE_PORT":9000 \
45-
--env-file <(set | grep BRIDGE) \
46-
--env BRIDGE_PLUGIN_PROXY='{"services": [{"consoleAPIPath": "/api/proxy/plugin/troubleshooting-panel-console-plugin/korrel8r/", "endpoint":"https://host.containers.internal:9005","authorize":true}]}' \
54+
--env-file <(bridge_vars_env) \
4755
$CONSOLE_IMAGE
4856
fi
4957
else
5058
BRIDGE_PLUGINS="troubleshooting-panel-console-plugin=http://host.docker.internal:9002,monitoring-plugin=http://host.docker.internal:9001"
5159
BRIDGE_PLUGIN_PROXY="{\"services\": [{\"consoleAPIPath\": \"/api/proxy/plugin/${npm_package_consolePlugin_name}/korrel8r/\", \"endpoint\":\"https://host.docker.internal:9005\",\"authorize\":true}]}"
52-
docker run --pull always --platform $CONSOLE_IMAGE_PLATFORM --rm -p "$CONSOLE_PORT":9000 --env-file <(set | grep BRIDGE) $CONSOLE_IMAGE
60+
docker run --pull always --platform $CONSOLE_IMAGE_PLATFORM --rm -p "$CONSOLE_PORT":9000 --env-file <(bridge_vars_env) $CONSOLE_IMAGE
5361
fi

0 commit comments

Comments
 (0)