feat: optimize IPFS configuration for better performance

This commit is contained in:
Prad Nukala 2024-09-26 16:03:08 -04:00
parent 08035b6f85
commit da199b0d76

View File

@ -3,9 +3,16 @@
# Exit immediately if a command exits with a non-zero status.
set -e
# Initialize IPFS
# 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() {
# Optimize local discovery and connectivity
ipfs config --json Discovery.MDNS.Enabled true
ipfs config --json Routing.Type "dhtclient"
@ -35,6 +42,9 @@ ipfs config Addresses.Gateway /ip4/127.0.0.1/tcp/8080
# Enable experimental features
ipfs config --json Experimental.FilestoreEnabled true
ipfs config --json Experimental.UrlstoreEnabled true
}
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
}