Skip to content

Instantly share code, notes, and snippets.

@nachocodexx
Created April 22, 2024 03:57
Show Gist options
  • Save nachocodexx/ae0b948f7e1ee092ff0429f6947e4c68 to your computer and use it in GitHub Desktop.
Save nachocodexx/ae0b948f7e1ee092ff0429f6947e4c68 to your computer and use it in GitHub Desktop.
#!/bin/bash
#readonly URL=${1:-http://localhost:60666}
readonly URL=${1:-http://148.247.201.141:60666}
#readonly URL=${1:-https://alpha.tamps.cinvestav.mx/v0/mictlanx/router}
peersprotocol=("http" "http")
peershostname=("mictlanx-peer-0" "mictlanx-peer-1")
peersport=("7000" "7001")
#peersport=("7001" "10000")
for ((i=0; i<${#peersprotocol[@]}; i++ )); do
protocol="${peersprotocol[i]}"
host_name="${peershostname[i]}"
pport="${peersport[i]}"
echo "$i $protocol://$host_name:$pport"
curl --request POST \
--url "${URL}/api/v4/peers" \
--header 'Content-Type: application/json' \
--data '{
"protocol":"'"$protocol"'",
"hostname":"'"$host_name"'",
"port":'"$pport"',
"peer_id":"'"$host_name"'"
}'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment