Skip to content

Instantly share code, notes, and snippets.

@danny8376
Last active March 9, 2024 04:26
Show Gist options
  • Save danny8376/24905d3ada81f4b5b1375c7792c59633 to your computer and use it in GitHub Desktop.
Save danny8376/24905d3ada81f4b5b1375c7792c59633 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
l="/ip4/127.0.0.1/tcp/5001"
c="/ip4/127.0.0.1/tcp/9095"
ipfs="/usr/bin/ipfs"
if [[ "$@" =~ "--api" ]]; then
$ipfs "$@"
elif [[ "$1" = "--local" || "$1" = "-L" ]]; then
shift
$ipfs --api "$l" "$@"
elif [[ "$1" = "--cluster" || "$1" = "-C" ]]; then
shift
$ipfs --api "$c" "$@"
else
$ipfs --api $l "$@"
#printf "Use cluster api? (Y/n)"
#read -n 1 A
#if [[ -n "$A" ]]; then echo ""; fi
#if [[ "$A" = "n" || "$A" = "N" ]]; then
# $ipfs --api $l "$@"
#else
# $ipfs --api $c "$@"
#fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment