PowerShell/Scripts/ipfs-server.sh

23 lines
655 B
Bash
Raw Normal View History

2020-05-29 20:45:13 +02:00
#!/bin/sh
# Syntax: ./ipfs-server
# Description: starts an IPFS server
# Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell
# License: CC0
2021-03-21 11:53:29 +01:00
HOSTNAME="`hostname`"
2020-05-29 20:45:13 +02:00
ipfs init --profile server
2020-09-25 19:12:06 +02:00
2020-05-29 20:45:13 +02:00
ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8765
2021-03-21 11:53:29 +01:00
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://$HOSTNAME:5001", "http://127.0.0.1:5001", "https://webui.ipfs.io"]'
2020-05-29 20:45:13 +02:00
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'
2020-09-25 19:12:06 +02:00
echo "NOTE: Make sure port 4001 for IPv4/v6 is open by your router!"
2021-03-21 11:53:29 +01:00
while true; do
ipfs daemon
done
2020-09-25 19:12:06 +02:00
exit 0
2020-05-29 20:45:13 +02:00