From d4db68e2ed7c398b7100102ec28d83d93d2aeda0 Mon Sep 17 00:00:00 2001 From: anomit ghosh Date: Sun, 13 Oct 2024 15:51:04 +0530 Subject: [PATCH] feat: accept third octet as an environment --- build.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 2814720..cf3e1e8 100755 --- a/build.sh +++ b/build.sh @@ -45,9 +45,11 @@ fi source .env export DOCKER_NETWORK_NAME="snapshotter-lite-v2-${SLOT_ID}" -# remove any existing network with this name -SUBNET_THIRD_OCTET=$((SLOT_ID % 256)) -# Use 172.18 as the first two octets +# Use 172.18.0.0/16 as the base, which is within Docker's default pool +if [ -z "$SUBNET_THIRD_OCTET" ]; then + SUBNET_THIRD_OCTET=$((SLOT_ID % 256)) + echo "SUBNET_THIRD_OCTET not found in .env, setting to default value ${SUBNET_THIRD_OCTET}" +fi export DOCKER_NETWORK_SUBNET="172.18.${SUBNET_THIRD_OCTET}.0/24" echo "Selected DOCKER_NETWORK_NAME: ${DOCKER_NETWORK_NAME}"