feat: adjust package to codex 0.2.0

This commit is contained in:
Slava 2025-02-26 16:58:49 +02:00
parent 6f8598ecd0
commit 2eb28bd731
No known key found for this signature in database
GPG Key ID: 351E7AA9BD0DFEB8
2 changed files with 6 additions and 5 deletions

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

View File

@ -109,8 +109,8 @@ fields:
service: codex-node
title: CODEX_NAT
description: >-
Public IP address to announce behind a NAT.
pattern: "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]?|0).){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]?|0)$"
Specify method to use for determining public address. Must be one of: `any`, `none`, `upnp`, `pmp`, `extip:<IP>`, default = `any`. Check the [docs](https://docs.codex.storage/learn/run#nat-configuration) for more details.
pattern: "^(any|none|upnp|pmp|extip:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]?|0).){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]?|0))$"
patternErrorMessage: Must be a valid IP address
required: true
if: { "IP_MODE": { "enum": ["manual"] } }