diff options
Diffstat (limited to 'lib/_ak_network_stellar')
-rwxr-xr-x | lib/_ak_network_stellar | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/lib/_ak_network_stellar b/lib/_ak_network_stellar index 04ce29b..d4fffcf 100755 --- a/lib/_ak_network_stellar +++ b/lib/_ak_network_stellar @@ -17,8 +17,18 @@ ### You should have received a copy of the GNU General Public License ### along with this program. If not, see <http://www.gnu.org/licenses/>. ### -source $AK_LIBDIR/_ak_log -source $AK_LIBDIR/_ak_ipfs +source $AK_LIBDIR/_ak_lib_load +_ak_lib_load _ak_log +_ak_lib_load _ak_script +_ak_lib_load _ak_ipfs + +stellarPeersDir="$AK_ZPEERSDIR/stellar" +_ak_check_and_create_dir $stellarPeersDir + +stellarParticipants="$stellarPeersDir/trustlines" +_ak_let_there_be_file $stellarParticipants +stellarParticipantsOnline="$stellarPeersDir/configured.trustlines" +_ak_let_there_be_file $stellarParticipantsOnline function _ak_network_stellar_show_ids(){ i=0 @@ -73,24 +83,8 @@ function _ak_network_stellar_scan(){ tempdir=`_ak_make_temp_directory` tempfile="$tempdir/tmp" tempaddr="$tempdir/tmpaddr" - stellarParticipants="$AK_WORKDIR/stellar-network-participants" - stellarParticipantsOnline="$AK_WORKDIR/stellar-network-participants-online" - if [ ! -f "$stellarParticipants" ] - then - touch $stellarParticipants - fi - if [ ! -f "$stellarParticipantsOnline" ] - then - touch $stellarParticipantsOnline - fi - if [ ! -f "$tempdir" ] - then - touch $tempdir - fi - if [ ! -f "$tempaddr" ] - then - touch $tempaddr - fi + _ak_let_there_be_file $tempdir + _ak_let_there_be_file $tempaddr if [ ! -z $1 ] && [ "$1" == "-l" ] && [ ! -z $2 ] then limit=$2 @@ -135,8 +129,6 @@ function _ak_network_stellar_scan(){ } function _ak_network_stellar_show_peers(){ - stellarParticipants="$AK_WORKDIR/stellar-network-participants" - stellarParticipantsOnline="$AK_WORKDIR/stellar-network-participants-online" if [ -f "${stellarParticipantsOnline}" ] then ( @@ -150,10 +142,16 @@ function _ak_network_stellar_show_peers(){ fi counter=$(( $counter + 1 )) akConfigHash="$(_ak_ipfs_name_resolve /ipns/$akConfig|cut -d '/' -f 3)" - printf '{"stellar":{"address":"%s","config":"%s"},"node_info":%s}' \ + printf '{"stellar":{"address":"%s","config":"%s"}' \ "$stellarAddress" \ - "$akConfig" \ - "$(_ak_ipfs_cat $akConfigHash)" + "$akConfig" + if [ -n "$akConfigHash" ] + then + printf ',"node_info":%s}' \ + "$(_ak_ipfs_cat $akConfigHash)" + else + printf '}' + fi done printf ']' ) | sed -e 's/\[]//g' #| jq @@ -161,3 +159,5 @@ function _ak_network_stellar_show_peers(){ _ak_log_debug "No stellar peers found" fi } + +_ak_log_debug "_ak_network_stellar loaded $(caller)" |