mirror of
https://github.com/logos-storage/get.codex.storage.git
synced 2026-01-06 23:23:09 +00:00
feat: add a way to get marketplace address from url
This commit is contained in:
parent
c85372b8b9
commit
edf8a238fd
29
run.sh
29
run.sh
@ -28,7 +28,7 @@ export CODEX_ETH_PRIVATE_KEY="${CODEX_ETH_PRIVATE_KEY:-eth.key}"
|
|||||||
export CODEX_ETH_PROVIDER="${CODEX_ETH_PROVIDER:-https://rpc.testnet.codex.storage}"
|
export CODEX_ETH_PROVIDER="${CODEX_ETH_PROVIDER:-https://rpc.testnet.codex.storage}"
|
||||||
[[ -n "${CODEX_MARKETPLACE_ADDRESS}" ]] && export CODEX_MARKETPLACE_ADDRESS="${CODEX_MARKETPLACE_ADDRESS}"
|
[[ -n "${CODEX_MARKETPLACE_ADDRESS}" ]] && export CODEX_MARKETPLACE_ADDRESS="${CODEX_MARKETPLACE_ADDRESS}"
|
||||||
|
|
||||||
# Default bootstrap nodes
|
# Bootstrap node from URL
|
||||||
BOOTSTRAP_NODE_FROM_URL="${BOOTSTRAP_NODE_FROM_URL:-https://spr.codex.storage/testnet}"
|
BOOTSTRAP_NODE_FROM_URL="${BOOTSTRAP_NODE_FROM_URL:-https://spr.codex.storage/testnet}"
|
||||||
WAIT=60
|
WAIT=60
|
||||||
SECONDS=0
|
SECONDS=0
|
||||||
@ -49,6 +49,29 @@ while (( SECONDS < WAIT )); do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Marketplace address from URL
|
||||||
|
if [[ ( -z "${CODEX_MARKETPLACE_ADDRESS}" || "$@" != *"--marketplace-address"* ) && -n "${MARKETPLACE_ADDRESS_FROM_URL}" ]]; then
|
||||||
|
|
||||||
|
echo "args - $@"
|
||||||
|
echo "CODEX_MARKETPLACE_ADDRESS - $CODEX_MARKETPLACE_ADDRESS"
|
||||||
|
echo "MARKETPLACE_ADDRESS_FROM_URL - $MARKETPLACE_ADDRESS_FROM_URL"
|
||||||
|
WAIT=60
|
||||||
|
SECONDS=0
|
||||||
|
SLEEP=1
|
||||||
|
while (( SECONDS < WAIT )); do
|
||||||
|
set +e
|
||||||
|
MARKETPLACE_ADDRESS=($(curl -s -f -m 5 "${MARKETPLACE_ADDRESS_FROM_URL}"))
|
||||||
|
set -e
|
||||||
|
if [[ $? -eq 0 && -n "${MARKETPLACE_ADDRESS}" ]]; then
|
||||||
|
export CODEX_MARKETPLACE_ADDRESS="${MARKETPLACE_ADDRESS}"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "Can't get Marketplace address from ${MARKETPLACE_ADDRESS_FROM_URL} - Retry in $SLEEP seconds / $((WAIT - SECONDS))"
|
||||||
|
sleep $SLEEP
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Help
|
# Help
|
||||||
if [[ $1 == *"help"* ]] ; then
|
if [[ $1 == *"help"* ]] ; then
|
||||||
COMMAND="curl -s ${SCRIPT_URL}"
|
COMMAND="curl -s ${SCRIPT_URL}"
|
||||||
@ -168,5 +191,5 @@ message="Running Codex"
|
|||||||
show_progress "${message}" && show_pass "${message}\n"
|
show_progress "${message}" && show_pass "${message}\n"
|
||||||
|
|
||||||
${CODEX_BINARY} \
|
${CODEX_BINARY} \
|
||||||
$@ \
|
persistence \
|
||||||
persistence
|
$@
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user