trufflesuite / ethpm-js

Javascript library for publishing and consuming Ethereum packages.
34 stars 13 forks source link

Feature Request: Add ability to store packages in local IPFS node #3

Closed pooleja closed 7 years ago

pooleja commented 7 years ago

I recently ran into a problem where IPFS files were no longer available. https://github.com/trufflesuite/truffle/issues/396

At the recommendation of another user, the topic came up of automatically storing any packages being used or published on a local IPFS node to ensure availability.

I am an IPFS noob, so I am not sure if this is something that is already available. If not, it would probably be a good integration option.

tcoulter commented 7 years ago

You can already do this, but it's undocumented. All you need to do add the ethpm parameter to your truffle.js config file. Something like this:

module.exports = {
  // ...
  ethpm: {
    ipfs_host: "ipfs.infura.io",
    ipfs_protocol: "https",
    registry: "0x8011df4830b4f696cd81393997e5371b93338878",
    install_provider_uri: "https://ropsten.infura.io/truffle"
  },
  // ... 
};

The original default values are configured here:

https://github.com/trufflesuite/truffle-config/blob/master/index.js#L34

You may need to make a copy of the whole configuration item, i.e., the whole ethpm object, rather than just changing ethpm.ipfs_host.

Cheers!