update docker files

- remove Disc_ip env
- update CODE_NAT parsing logic
This commit is contained in:
munna0908 2025-01-07 17:53:44 +05:30
parent b387b6aff4
commit beae8a4283
No known key found for this signature in database
GPG Key ID: 2FFCD637E937D3E6
3 changed files with 4 additions and 6 deletions

View File

@ -139,8 +139,6 @@ type
abbr: "i"
name: "listen-addrs" }: seq[MultiAddress]
# TODO: change this once we integrate nat support
nat* {.
desc: "Specify method to use for determining public address. " &
"Must be one of: any, none, upnp, pmp, extip:<IP>"

View File

@ -9,7 +9,6 @@ services:
- CODEX_DATA_DIR=${CODEX_DATA_DIR:-/datadir}
- CODEX_LISTEN_ADDRS=${CODEX_LISTEN_ADDRS:-/ip4/0.0.0.0/tcp/2345}
- CODEX_NAT=${CODEX_NAT:-10.0.0.10}
- CODEX_DISC_IP=${CODEX_DISC_IP:-0.0.0.0}
- CODEX_DISC_PORT=${CODEX_DISC_PORT:-8090}
- CODEX_NET_PRIVKEY=${CODEX_NET_PRIVKEY:-key}
# - CODEX_BOOTSTRAP_NODE=${CODEX_BOOTSTRAP_NODE}

View File

@ -12,7 +12,7 @@ fi
# Parameters
if [[ -z "${CODEX_NAT}" ]]; then
if [[ "${NAT_IP_AUTO}" == "true" && -z "${NAT_PUBLIC_IP_AUTO}" ]]; then
export CODEX_NAT=$(hostname --ip-address)
export CODEX_NAT="extip:$(hostname --ip-address)"
echo "Private: CODEX_NAT=${CODEX_NAT}"
elif [[ -n "${NAT_PUBLIC_IP_AUTO}" ]]; then
# Run for 60 seconds if fail
@ -20,9 +20,10 @@ if [[ -z "${CODEX_NAT}" ]]; then
SECONDS=0
SLEEP=5
while (( SECONDS < WAIT )); do
export CODEX_NAT=$(curl -s -f -m 5 "${NAT_PUBLIC_IP_AUTO}")
IP=$(curl -s -f -m 5 "${NAT_PUBLIC_IP_AUTO}")
# Check if exit code is 0 and returned value is not empty
if [[ $? -eq 0 && -n "${CODEX_NAT}" ]]; then
if [[ $? -eq 0 && -n "${IP}" ]]; then
export CODEX_NAT="extip:${IP}"
echo "Public: CODEX_NAT=${CODEX_NAT}"
break
else