initialized ipfs object to environment

This commit is contained in:
Iuri Matias 2018-05-18 15:56:36 -04:00
parent e2c2373249
commit 0363c676d4
2 changed files with 10 additions and 0 deletions

View File

@ -22,6 +22,7 @@ class Console {
'versions - ' + __('display versions in use for libraries and tools like web3 and solc'), 'versions - ' + __('display versions in use for libraries and tools like web3 and solc'),
// TODO: only if the blockchain is actually active! // TODO: only if the blockchain is actually active!
// will need to pass te current embark state here // will need to pass te current embark state here
'ipfs - ' + __('instantiated js-ipfs object configured to the current environment (available if ipfs is enabled)'),
'web3 - ' + __('instantiated web3.js object configured to the current environment'), 'web3 - ' + __('instantiated web3.js object configured to the current environment'),
'quit - ' + __('to immediatly exit (alias: exit)'), 'quit - ' + __('to immediatly exit (alias: exit)'),
'', '',

View File

@ -1,6 +1,8 @@
let UploadIPFS = require('./upload.js'); let UploadIPFS = require('./upload.js');
let utils = require('../../utils/utils.js'); let utils = require('../../utils/utils.js');
let fs = require('../../core/fs.js'); let fs = require('../../core/fs.js');
let RunCode = require('../../core/runCode.js');
let IpfsApi = require('ipfs-api');
class IPFS { class IPFS {
@ -18,6 +20,7 @@ class IPFS {
this.setServiceCheck(); this.setServiceCheck();
this.addIPFSToEmbarkJS(); this.addIPFSToEmbarkJS();
this.addSetProvider(); this.addSetProvider();
this.addIpfsObjectToConsole();
} }
commandlineDeploy() { commandlineDeploy() {
@ -111,6 +114,12 @@ class IPFS {
this.embark.addProviderInit('storage', code, shouldInit); this.embark.addProviderInit('storage', code, shouldInit);
} }
addIpfsObjectToConsole() {
let ipfs = IpfsApi(this.storageConfig.host, this.storageConfig.port);
RunCode.doEval("", {ipfs: ipfs});
}
} }
module.exports = IPFS; module.exports = IPFS;