astroport/.install/ipfs/nodeinfo-ipfs

26 lines
462 B
Bash
Executable File

#!/bin/sh
ipfsinfo=$( curl -s http://localhost:5001/api/v0/id)
id=$(echo $ipfsinfo | jq ".ID")
version=$(echo $ipfsinfo | jq ".AgentVersion")
if [ -z "$id" ]; then
id='""'
fi
if [ -z "$version" ]; then
version='""'
fi
echo '"ipfs":{'
echo '"version":'${version}','
if [ quic_enabled = "$(ipfs config Experimental.QUIC)" ]; then
echo '"quic_enabled":"'${quic_enabled}'",'
else
echo '"quic_enabled":"false",'
fi
echo '"ID":'${id}
echo "},"