Skip to content

Commit

Permalink
Enable RPC port in general scenarios (#7177)
Browse files Browse the repository at this point in the history
  • Loading branch information
upbqdn authored Jul 10, 2023
1 parent 8c5bcb7 commit 776c7c7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions docker/runtime-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ fi
: "${TRACING_ENDPOINT_PORT:=3000}"
# [rpc]
: "${RPC_LISTEN_ADDR:=0.0.0.0}"
if [[ -z "${RPC_PORT}" ]]; then
if [[ " ${FEATURES} " =~ " getblocktemplate-rpcs " ]]; then
if [[ "${NETWORK}" = "Mainnet" ]]; then
: "${RPC_PORT:=8232}"
elif [[ "${NETWORK}" = "Testnet" ]]; then
: "${RPC_PORT:=18232}"
fi

fi
fi

# Populate `zebrad.toml` before starting zebrad, using the environmental
# variables set by the Dockerfile or the user. If the user has already created a config, don't replace it.
Expand Down Expand Up @@ -65,9 +68,8 @@ endpoint_addr = "${METRICS_ENDPOINT_ADDR}:${METRICS_ENDPOINT_PORT}"
EOF
fi

# Set this to enable the RPC port
if [[ " $FEATURES " =~ " getblocktemplate-rpcs " ]]; then # spaces are important here to avoid partial matches
cat <<EOF >> "$ZEBRA_CONF_PATH"
if [[ "${RPC_PORT}" ]]; then
cat <<EOF >> "${ZEBRA_CONF_PATH}"
[rpc]
listen_addr = "${RPC_LISTEN_ADDR}:${RPC_PORT}"
EOF
Expand Down

0 comments on commit 776c7c7

Please sign in to comment.