Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts/mock-adapter.sh: fix listen address defaults #351

Merged
merged 1 commit into from
Aug 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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