Skip to content

Commit

Permalink
fix: allow faucet-helper.sh to work without web access
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Aug 23, 2020
1 parent 6c76bcc commit 8439ba3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,13 @@ STAKE=50000000uagstake
OP=$1
shift

NETWORK_CONFIG_URL="{{ NETWORK_CONFIG_URL }}"
nc=$(curl -s $NETWORK_CONFIG_URL)
chainName=$(echo "$nc" | jq -r .chainName)
rpcAddrs=$(echo "$nc" | jq .rpcAddrs)
numAddrs=$(echo "$rpcAddrs" | jq '. | length')
chainName=$(cat "$thisdir/ag-chain-cosmos/chain-name.txt")
IFS=, read -r -a rpcAddrs <<<"$(AG_SETUP_COSMOS_HOME=$thisdir ag-setup-cosmos show-rpcaddrs)"

while [[ $numAddrs -gt 0 ]]; do
r=$(( $RANDOM % $numAddrs ))
selected=$(echo "$rpcAddrs" | jq -r ".[$r]")
rpcAddrs=$(echo "$rpcAddrs" | jq ".[0:$r] + .[$(( $r + 1 )):$numAddrs]")
numAddrs=$(echo "$rpcAddrs" | jq '. | length')
while [[ ${#rpcAddrs[@]} -gt 0 ]]; do
r=$(( $RANDOM % ${#rpcAddrs[@]} ))
selected=${rpcAddrs[$r]}
rpcAddrs=( ${rpcAddrs[@]/$selected} )

# echo "Checking if $selected is alive"
if [[ $(curl -s http://$selected/status | jq .result.sync_info.catching_up) == false ]]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- name: "Create faucet-helper.sh"
- name: "Copy faucet-helper.sh"
delegate_to: localhost
template:
src: faucet-helper.sh.j2
copy:
src: faucet-helper.sh
dest: "{{ SETUP_HOME + '/faucet-helper.sh' }}"
mode: '755'

Expand Down

0 comments on commit 8439ba3

Please sign in to comment.