Skip to content

Commit

Permalink
scripts/mock-adapter.sh: fix listen address defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
cfal committed Aug 11, 2023
1 parent 0b0d052 commit 4b6388a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion scripts/mock-adapter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,21 @@ binary_path="${cache_path}/bin/${binary_name}"

bash "$(dirname -- "$0")/mock-adapter.down.sh"

listen_address="127.0.0.1:6060"
if [ $# -gt 0 ]; then
listen_address="$1"
elif [ "$(uname)" = "Darwin" ]; then
echo "Listening on all interfaces on MacOS"
listen_address="0.0.0.0:6060"
else
docker_ip=$(docker network inspect bridge -f '{{range .IPAM.Config}}{{.Gateway}}{{end}}')
if [ -z "${docker_ip}" ]; then
echo "Could not fetch docker ip."
exit 1
fi
echo "Listening on docker interface"
listen_address="${docker_ip}:6060"
fi

echo "Listen address: ${listen_address}"

if [ ! -f "${binary_path}" ]; then
Expand Down

0 comments on commit 4b6388a

Please sign in to comment.