From 72f3e6cbffb75e90bbd60d226deb3d8cfa2690c4 Mon Sep 17 00:00:00 2001 From: kant777 <61204489+kant777@users.noreply.github.com> Date: Sat, 13 Jan 2024 02:56:21 -0800 Subject: [PATCH] Update entrypoint.sh --- geth-poa/entrypoint.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/geth-poa/entrypoint.sh b/geth-poa/entrypoint.sh index 3bee25e478..268e0b3aaa 100644 --- a/geth-poa/entrypoint.sh +++ b/geth-poa/entrypoint.sh @@ -43,7 +43,13 @@ fi # Obtain assigned container IP for p2p NODE_IP=${NODE_IP:-$(hostname -i)} -PUBLIC_NODE_IP=${PUBLIC_NODE_IP:-$NODE_IP} + +if [ -n "$PUBLIC_NODE_IP" ]; then + NAT_FLAG="--nat extip:$PUBLIC_NODE_IP" +else + NAT_FLAG="--nat none" +fi + # (Optional) Echo the values for verification echo "NODE_IP is set to: $NODE_IP" @@ -84,7 +90,7 @@ if [ "$GETH_NODE_TYPE" = "bootnode" ]; then --pprof.port=60601 \ --nodekey $GETH_DATA_DIR/boot.key \ --netrestrict $NET_RESTRICT \ - --nat extip:$PUBLIC_NODE_IP \ + $NAT_FLAG \ --txpool.accountqueue=512 \ --rpc.allow-unprotected-txs @@ -130,7 +136,7 @@ elif [ "$GETH_NODE_TYPE" = "signer" ]; then --authrpc.port="8551" \ --authrpc.vhosts="*" \ --txpool.accountqueue=512 \ - --nat extip:$PUBLIC_NODE_IP + $NAT_FLAG elif [ "$GETH_NODE_TYPE" = "member" ]; then echo "Starting member node" @@ -168,7 +174,7 @@ elif [ "$GETH_NODE_TYPE" = "member" ]; then --authrpc.port="8551" \ --authrpc.vhosts="*" \ --txpool.accountqueue=512 \ - --nat extip:$PUBLIC_NODE_IP + $NAT_FLAG else echo "Invalid GETH_NODE_TYPE specified" fi