diff --git a/codex/conf.nim b/codex/conf.nim index aebbe444..cab86b4d 100644 --- a/codex/conf.nim +++ b/codex/conf.nim @@ -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:" diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index f2d76d23..9ffdd821 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -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} diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index c824c7c6..2ec840e9 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -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