Skip to content

Instantly share code, notes, and snippets.

@laser
Created May 29, 2020 22:17
Show Gist options
  • Save laser/5635a7dc9c27f6348cd7ee739813044f to your computer and use it in GitHub Desktop.
Save laser/5635a7dc9c27f6348cd7ee739813044f to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -x
public_ip=$(curl -m 5 http://169.254.169.254/latest/meta-data/public-ipv4 || echo "127.0.0.1")
daemon_multiaddr=$(lotus net listen | grep 127 | sed -En "s/127\.0\.0\.1/${public_ip}/p")
miner_multiaddr=$(lotus-storage-miner net listen | grep 127 | sed -En "s/127\.0\.0\.1/${public_ip}/p")
miner_id=$(lotus-storage-miner info | grep Miner | cut -d ' ' -f2)
cd $(mktemp -d)
printf '{"daemon_multiaddr": "%s", "miner_multiaddr": "%s", "miner_id": "%s"}' $daemon_multiaddr $miner_multiaddr $miner_id > ./publish.json
python -m SimpleHTTPServer ${publish_port}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment