support setting protocol in config; fix getUrl
This commit is contained in:
parent
bde067aabf
commit
13e759bfee
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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 + ");";
|
||||
|
|
|
@ -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/"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue