misc/docker-entrypoint.sh

Thu, 23 Mar 2023 18:28:20 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 23 Mar 2023 18:28:20 +0000
changeset 181
3a9b9c98304a
parent 94
1b3e848b4394
permissions
-rw-r--r--

Add support for component connections

#!/bin/bash

ARGS=""

if [[ "$SERVER_HOST" ]]; then
	ARGS="$ARGS -h $SERVER_HOST";
else
	# In the interests of sane convenient defaults, discover the host
	# IP address (only possible in bridged networks), and default to that
	GATEWAY_IP=$(printf "%d.%d.%d.%d" $(awk '$2 == 00000000 { for (i = 8; i >= 2; i=i-2) { print "0x" substr($3, i-1, 2) } }' /proc/net/route))

	if [[ "$GATEWAY_IP" != "0.0.0.0" ]]; then
		ARGS="$ARGS -h $GATEWAY_IP"
	fi
fi
if [[ "$SERVER_PORT" ]]; then
	ARGS="$ARGS -p $SERVER_PORT";
fi

exec /usr/local/bin/scansion $ARGS "$@"

mercurial