support specifying ipfs protocol in the storage provider

This commit is contained in:
Iuri Matias 2018-03-02 11:02:52 -05:00
parent 59678dd1fa
commit bde067aabf

View File

@ -10,7 +10,14 @@ __embarkIPFS.setProvider = function(options) {
self.ipfsConnection = IpfsApi('localhost', '5001');
self._getUrl = "http://localhost:8080/ipfs/";
} else {
self.ipfsConnection = IpfsApi(options.server, options.port);
var ipfsOptions = {host: options.server, protocol: 'http'};
if (options.protocol) {
ipfsOptions.protocol = options.protocol;
}
if (options.port) {
ipfsOptions.port = options.port;
}
self.ipfsConnection = IpfsApi(ipfsOptions);
self._getUrl = options.getUrl || "http://localhost:8080/ipfs/";
}
resolve(self);