Skip to content

Commit

Permalink
feat: accept third octet as an environment
Browse files Browse the repository at this point in the history
  • Loading branch information
anomit committed Oct 13, 2024
1 parent 667a9fa commit d4db68e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit d4db68e

Please sign in to comment.