Merge branch 'main' of github.com:StakeSquid/ethereum-rpc-docker into main

This commit is contained in:
Sebastian
2025-03-19 12:59:54 +01:00
2 changed files with 19 additions and 7 deletions

View File

@@ -27,7 +27,7 @@ start:
--http.vhosts=*
--ws
--ws.addr=0.0.0.0
--ws.port=9756
--ws.port=8454
--metrics
--metrics.addr=0.0.0.0
--metrics.port=7070

View File

@@ -3,8 +3,17 @@
BASEPATH="$(dirname "$0")"
source $BASEPATH/.env
GENERATE_ID_FROM_PATH_EXPRESSION=${GENERATE_ID_FROM_PATH_EXPRESSION:-'s/^rpc-(.*)\.stakesquid\.eu\/(.*)$/\1-\2/'}
LOCAL=${1:-false}
if [ -n "$NO_SSL" ]; then
PROTO="http"
DOMAIN="${DOMAIN:-0.0.0.0}"
else
PROTO="https"
fi
IFS=':' read -ra parts <<< $COMPOSE_FILE
blacklist=("drpc.yml" "drpc-free.yml" "base.yml" "rpc.yml" "monitoring.yml")
@@ -41,19 +50,19 @@ for part in "${parts[@]}"; do
if $path_include; then
#echo "LOCAL: $LOCAL"
if $LOCAL; then
url=$("$BASEPATH/get-local-url.sh" "${part%.yml}")
TEST_URL="https://$DOMAIN$path"
export TEST_URL="$PROTO://$DOMAIN$path"
export RPC_URL="http://$url"
export WS_URL="ws://$url"
export ID=$(echo "$DOMAIN$path" | sed -E 's/^rpc-(.*)\.stakesquid\.eu\/(.*)$/\1-\2/')
export ID=$(echo "$DOMAIN$path" | sed -E "$GENERATE_ID_FROM_PATH_EXPRESSION")
else
url="$DOMAIN$path"
export RPC_URL="https://$url"
export RPC_URL="$PROTO://$url"
export TEST_URL="$RPC_URL"
export WS_URL="wss://$url"
export ID=$(echo "$url" | sed -E 's/^rpc-(.*)\.stakesquid\.eu\/(.*)$/\1-\2/')
export ID=$(echo "$url" | sed -E "$GENERATE_ID_FROM_PATH_EXPRESSION")
fi
export PROVIDER=${ORGANIZATION}-${ID}
@@ -62,6 +71,8 @@ for part in "${parts[@]}"; do
http_status_code=$(curl --ipv4 -m 5 -s -o "$response_file" -w "%{http_code}" -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' $TEST_URL)
curl_status=$?
if [ $? -eq 0 ] && [[ $http_status_code -ne 200 ]]; then
echo "have error response from $TEST_URL: $(cat $response_file)" >&2
rm "$response_file"
@@ -69,6 +80,7 @@ for part in "${parts[@]}"; do
fi
chain_id=$(cat "$response_file" | jq -r '.result')
#echo "$http_status_code: $(cat $response_file)"
rm "$response_file"
#echo "$TEST_URL $chain_id" >&2