mirror of https://github.com/embarklabs/embark.git
make storage getUrl configurable
This commit is contained in:
parent
fbfb5269b0
commit
2bf91b6d9a
|
@ -208,8 +208,10 @@ EmbarkJS.Storage.setProvider = function(provider, options) {
|
|||
try {
|
||||
if (options === undefined) {
|
||||
self.ipfsConnection = IpfsApi('localhost', '5001');
|
||||
self.getUrl = "http://localhost:8080/ipfs/";
|
||||
} else {
|
||||
self.ipfsConnection = IpfsApi(options.server, options.port);
|
||||
self.getUrl = options.getUrl || "http://localhost:8080/ipfs/";
|
||||
}
|
||||
resolve(self);
|
||||
} catch (err) {
|
||||
|
@ -301,7 +303,8 @@ EmbarkJS.Storage.IPFS.uploadFile = function(inputSelector) {
|
|||
EmbarkJS.Storage.IPFS.getUrl = function(hash) {
|
||||
//var ipfsHash = web3.toAscii(hash);
|
||||
|
||||
return 'http://localhost:8080/ipfs/' + hash;
|
||||
//return 'http://localhost:8080/ipfs/' + hash;
|
||||
return (self.getUrl || "http://localhost:8080/ipfs/") + hash;
|
||||
};
|
||||
|
||||
//=========================================================
|
||||
|
|
|
@ -158,7 +158,8 @@ class ABIGenerator {
|
|||
if (!useEmbarkJS || self.storageConfig === {}) return "";
|
||||
|
||||
if (self.storageConfig.provider === 'ipfs' && self.storageConfig.enabled === true) {
|
||||
result += "\nEmbarkJS.Storage.setProvider('" + self.storageConfig.provider + "', {server: '" + self.storageConfig.host + "', port: '" + self.storageConfig.port + "'});";
|
||||
// TODO: make this more readable
|
||||
result += "\nEmbarkJS.Storage.setProvider('" + self.storageConfig.provider + "', {server: '" + self.storageConfig.host + "', port: '" + self.storageConfig.port + "', getUrl: '" + self.storageConfig.getUrl + "'});";
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -119,7 +119,8 @@ Config.prototype.loadStorageConfigFile = function() {
|
|||
"ipfs_bin": "ipfs",
|
||||
"provider": "ipfs",
|
||||
"host": "localhost",
|
||||
"port": 5001
|
||||
"port": 5001,
|
||||
"getUrl": "http://localhost:8080/ipfs/"
|
||||
},
|
||||
"development": {
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"enabled": true,
|
||||
"provider": "ipfs",
|
||||
"host": "localhost",
|
||||
"port": 5001
|
||||
"port": 5001,
|
||||
"getUrl": "http://localhost:8080/ipfs/"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue