node-distro/s6/ipfs/etc/cont-init.d/20-ipfs

24 lines
860 B
Plaintext

#!/usr/bin/with-contenv bash
if [[ ! -d "$IPFS_PATH" ]]; then
ipfs init
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 '"/ip4/0.0.0.0/tcp/5001"'
ipfs config --json Addresses.Gateway '"/ip4/0.0.0.0/tcp/8080"'
# 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
mkdir -p $IPFS_PATH $IPFS_LOG_DIR
chown -R abc:abc $IPFS_PATH $IPFS_LOG_DIR