diff --git a/bedrock-entry.sh b/bedrock-entry.sh index 3a689e6..5cf90bd 100755 --- a/bedrock-entry.sh +++ b/bedrock-entry.sh @@ -445,6 +445,14 @@ if [[ -n "$ALLOW_LIST_USERS" || -n "$WHITE_LIST_USERS" ]]; then fi fi +if [[ "$SERVER_UDP_PORTS" == *""* ]]; then + echo "Replacing in $SERVER_UDP_PORTS" + public_ip=$(curl -s ifconfig.me) + echo "Public IP resolved to: $public_ip" + SERVER_UDP_PORTS="${SERVER_UDP_PORTS///$public_ip}" + export SERVER_UDP_PORTS +fi + if [[ -n "$VARIABLES" ]]; then echo "Setting variables" mkdir -p config/default diff --git a/examples/nethernet/compose.yml b/examples/nethernet/compose.yml index 730cc03..6e93b34 100644 --- a/examples/nethernet/compose.yml +++ b/examples/nethernet/compose.yml @@ -9,6 +9,9 @@ services: # Advertised mapping behind Docker bridge / extra NAT: :external-udp:internal-udp # (IPv4 or IPv6 literal, not a hostname) # SERVER_UDP_PORTS: ":19140-19155:19140-19155" + # you may use the literal string , which will be replaced with your public ip from + # curl ifconfig.me on startup + # SERVER_UDP_PORTS: ":19140-19155:19140-19155" ports: - "19132:19132/tcp" - "19140-19155:19140-19155/udp"