From 5ef00c3910c6f78861ee60c60fb3761855930442 Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Thu, 26 Sep 2024 16:04:48 -0400 Subject: [PATCH] refactor: move ipfs setup to function --- scripts/bootstrap_ipfs.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/scripts/bootstrap_ipfs.sh b/scripts/bootstrap_ipfs.sh index e9eb628a2..c0d13be69 100755 --- a/scripts/bootstrap_ipfs.sh +++ b/scripts/bootstrap_ipfs.sh @@ -3,16 +3,10 @@ # Exit immediately if a command exits with a non-zero status. set -e -# check if ~/.ipfs exists, if not create it -if [ ! -d ~/.ipfs ]; then - ipfs init - setup_ipfs - start_ipfs -else - start_ipfs -fi - function setup_ipfs() { + # Install IPFS + ipfs init + # Optimize local discovery and connectivity ipfs config --json Discovery.MDNS.Enabled true ipfs config --json Routing.Type "dhtclient" @@ -48,3 +42,12 @@ function start_ipfs() { # Start the IPFS daemon with additional options for better performance and compatibility ipfs daemon --enable-gc --migrate --enable-pubsub-experiment --enable-namesys-pubsub } + +# check if ~/.ipfs exists, if not create it +if [ ! -d ~/.ipfs ]; then + setup_ipfs + start_ipfs +else + start_ipfs +fi +