mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 13:07:09 +00:00
refactor: move ipfs setup to function
This commit is contained in:
parent
da199b0d76
commit
5ef00c3910
@ -3,16 +3,10 @@
|
|||||||
# Exit immediately if a command exits with a non-zero status.
|
# Exit immediately if a command exits with a non-zero status.
|
||||||
set -e
|
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() {
|
function setup_ipfs() {
|
||||||
|
# Install IPFS
|
||||||
|
ipfs init
|
||||||
|
|
||||||
# Optimize local discovery and connectivity
|
# Optimize local discovery and connectivity
|
||||||
ipfs config --json Discovery.MDNS.Enabled true
|
ipfs config --json Discovery.MDNS.Enabled true
|
||||||
ipfs config --json Routing.Type "dhtclient"
|
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
|
# Start the IPFS daemon with additional options for better performance and compatibility
|
||||||
ipfs daemon --enable-gc --migrate --enable-pubsub-experiment --enable-namesys-pubsub
|
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
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user