mirror of
https://github.com/fluencelabs/node-distro
synced 2024-12-13 03:05:33 +00:00
2488f2b317
* Manage IPFS addresses settings * Typo * Fix README * Fix readme * Use tcp entrypoint * Apply suggestions from code review Co-authored-by: folex <0xdxdy@gmail.com> * Fix README Co-authored-by: folex <0xdxdy@gmail.com>
35 lines
1.1 KiB
Plaintext
35 lines
1.1 KiB
Plaintext
#!/usr/bin/with-contenv bash
|
|
|
|
if [[ ! -d "$IPFS_PATH" ]]; then
|
|
ipfs init
|
|
|
|
# remove default bootstraps
|
|
ipfs bootstrap rm --all
|
|
|
|
# enable Private Network feature by copying swarm.key to $IPFS_PATH
|
|
# https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#private-networks
|
|
cp /defaults/ipfs_preshared_swarm.key $IPFS_PATH/swarm.key
|
|
|
|
# to check that Private Network is enabled, look for a line
|
|
# 'Swarm is limited to private network of peers with the swarm key'
|
|
# in IPFS logs
|
|
fi
|
|
|
|
if [[ "$IPFS_MIGRATE_FS" == true ]]; then
|
|
fs-repo-migrations -y
|
|
fi
|
|
|
|
to_json() {
|
|
echo "$1" | jq -Rc 'split(",")'
|
|
}
|
|
|
|
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
|
|
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST"]'
|
|
ipfs config --json Addresses.API $(to_json ${IPFS_ADDRESSES_API})
|
|
ipfs config --json Addresses.Gateway $(to_json ${IPFS_ADDRESSES_GATEWAY})
|
|
ipfs config --json Addresses.Swarm $(to_json ${IPFS_ADDRESSES_SWARM})
|
|
ipfs config --json Addresses.Announce $(to_json ${IPFS_ADDRESSES_ANNOUNCE})
|
|
|
|
mkdir -p $IPFS_PATH $IPFS_LOG_DIR
|
|
chown -R abc:abc $IPFS_PATH $IPFS_LOG_DIR
|