1
0

entrypoint.sh 777 B

12345678910111213141516171819202122232425
  1. #!/bin/sh
  2. export IPFS_CONFIG_PATH="$IPFS_PATH/config"
  3. if [ ! -e "$IPFS_CONFIG_PATH" ]; then
  4. (set -x; ipfs init --empty-repo --profile $IPFS_INIT_PROFILE)
  5. fi
  6. if [ "$IPFS_SWARM_ADDRS" != "default" ]; then
  7. # + ipfs config --json Addresses.Swarm '["/ip4/0.0.0.0/tcp/4001"]'
  8. # Error: api not running
  9. tmp=$(mktemp)
  10. (set -x; jq '.Addresses.Swarm |= $ARGS.positional' --args $IPFS_SWARM_ADDRS <"$IPFS_CONFIG_PATH" >$tmp)
  11. mv $tmp "$IPFS_CONFIG_PATH"
  12. fi
  13. if [ ! -z "$IPFS_BOOTSTRAP_ADD" ]; then
  14. # + ipfs bootstrap add -- /dnsaddr/...
  15. # Error: api not running
  16. tmp=$(mktemp)
  17. (set -x; jq '.Bootstrap |= (. + $ARGS.positional | unique)' --args $IPFS_BOOTSTRAP_ADD <"$IPFS_CONFIG_PATH" >$tmp)
  18. mv $tmp "$IPFS_CONFIG_PATH"
  19. fi
  20. (set -x; exec "$@")