Skip to content

Instantly share code, notes, and snippets.

@heathdrobertson
Last active January 11, 2020 13:51
Show Gist options
  • Save heathdrobertson/9e7ff6a7fa0b2b9f36db5d0b5689d926 to your computer and use it in GitHub Desktop.
Save heathdrobertson/9e7ff6a7fa0b2b9f36db5d0b5689d926 to your computer and use it in GitHub Desktop.
with import <nixpkgs> {};
# with pkgs;
stdenv.mkDerivation {
name = "ipfsenv";
buildInputs = [ipfs];
shellHook = ''
ipfs init
# stop executing if anything fails
set -e
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://127.0.0.1:8080", "http://127.0.0.1:5001", "https://webui.ipfs.io"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "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"'
echo "IPFS API CORS headers configured for Allow-Origin & Allow-Methods."
echo "IPFS API & Gateway IP set to 0.0.0.0 to run from withing the container."
echo "Please restart your IPFS daemon"
ipfs daemon
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment