validator.sh now supports an --entrypoint arg, mimicking the solana-validator CLI API (#5363)

This commit is contained in:
Michael Vines
2019-07-31 09:54:39 -07:00
committed by GitHub
parent 6df1f6450f
commit c209e14e40
2 changed files with 21 additions and 6 deletions

View File

@ -103,6 +103,7 @@ airdrops_enabled=1
boot_from_snapshot=1 boot_from_snapshot=1
reset_ledger=0 reset_ledger=0
config_dir= config_dir=
gossip_entrypoint=
positional_args=() positional_args=()
while [[ -n $1 ]]; do while [[ -n $1 ]]; do
@ -123,6 +124,10 @@ while [[ -n $1 ]]; do
stake_lamports=0 stake_lamports=0
args+=("$1" "$2") args+=("$1" "$2")
shift 2 shift 2
elif [[ $1 = --entrypoint ]]; then
gossip_entrypoint=$2
args+=("$1" "$2")
shift 2
elif [[ $1 = --identity ]]; then elif [[ $1 = --identity ]]; then
identity_keypair_path=$2 identity_keypair_path=$2
args+=("$1" "$2") args+=("$1" "$2")
@ -207,13 +212,23 @@ mkdir -p "$config_dir"
setup_secondary_mount setup_secondary_mount
entrypoint_hostname=${positional_args[0]} if [[ -n $gossip_entrypoint ]]; then
if [[ -z $entrypoint_hostname ]]; then # Prefer the --entrypoint argument if supplied...
entrypoint_hostname=127.0.0.1 if [[ ${#positional_args[@]} -gt 0 ]]; then
fullnode_usage "$@"
fi
else
# ...but also support providing the entrypoint's hostname as the first
# positional argument
entrypoint_hostname=${positional_args[0]}
if [[ -z $entrypoint_hostname ]]; then
gossip_entrypoint=127.0.0.1:8001
else
gossip_entrypoint="$entrypoint_hostname":8001
fi
fi fi
gossip_entrypoint="$entrypoint_hostname":8001
rpc_url=$("$here"/rpc-url.sh "$gossip_entrypoint") rpc_url=$("$here"/rpc-url.sh "$gossip_entrypoint")
drone_address="$entrypoint_hostname":9900 drone_address="${gossip_entrypoint%:*}":9900
: "${identity_keypair_path:=$config_dir/identity-keypair.json}" : "${identity_keypair_path:=$config_dir/identity-keypair.json}"
[[ -r "$identity_keypair_path" ]] || $solana_keygen new -o "$identity_keypair_path" [[ -r "$identity_keypair_path" ]] || $solana_keygen new -o "$identity_keypair_path"

View File

@ -190,7 +190,7 @@ local|tar|skip)
fi fi
args=( args=(
"$entrypointIp:8001" --entrypoint "$entrypointIp:8001"
--gossip-port 8001 --gossip-port 8001
--rpc-port 8899 --rpc-port 8899
) )