diff --git a/lib/modules/ipfs/embarkjs.js b/lib/modules/ipfs/embarkjs.js index 53e18567..0412babd 100644 --- a/lib/modules/ipfs/embarkjs.js +++ b/lib/modules/ipfs/embarkjs.js @@ -14,7 +14,7 @@ __embarkIPFS.setProvider = function(options) { if (options.protocol) { ipfsOptions.protocol = options.protocol; } - if (options.port) { + if (options.port && options.port !== 'false') { ipfsOptions.port = options.port; } self.ipfsConnection = IpfsApi(ipfsOptions); @@ -100,6 +100,6 @@ __embarkIPFS.uploadFile = function(inputSelector) { }; __embarkIPFS.getUrl = function(hash) { - return (self._getUrl || "http://localhost:8080/ipfs/") + hash; + return (this._getUrl || "http://localhost:8080/ipfs/") + hash; }; diff --git a/lib/modules/ipfs/index.js b/lib/modules/ipfs/index.js index 2a09d03c..e0f03a44 100644 --- a/lib/modules/ipfs/index.js +++ b/lib/modules/ipfs/index.js @@ -96,6 +96,7 @@ class IPFS { let config = JSON.stringify({ server: this.storageConfig.host, port: this.storageConfig.port, + protocol: this.storageConfig.protocol, getUrl: this.storageConfig.getUrl }); let code = "\nEmbarkJS.Storage.setProvider('ipfs'," + config + ");"; diff --git a/test_app/config/storage.json b/test_app/config/storage.json index a21b4cde..5492ed28 100644 --- a/test_app/config/storage.json +++ b/test_app/config/storage.json @@ -16,5 +16,13 @@ "host": "localhost", "port": 5001, "getUrl": "http://localhost:8080/ipfs/" + }, + "livenet": { + "enabled": true, + "provider": "ipfs", + "host": "ipfs.infura.io", + "protocol": "https", + "port": false, + "getUrl": "https://ipfs.infura.io/ipfs/" } }