From 0363c676d475acc4b56279cefa2ef58ec5d76cfc Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 18 May 2018 15:56:36 -0400 Subject: [PATCH] initialized ipfs object to environment --- lib/dashboard/console.js | 1 + lib/modules/ipfs/index.js | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/lib/dashboard/console.js b/lib/dashboard/console.js index edd3feff3..c78a97821 100644 --- a/lib/dashboard/console.js +++ b/lib/dashboard/console.js @@ -22,6 +22,7 @@ class Console { 'versions - ' + __('display versions in use for libraries and tools like web3 and solc'), // TODO: only if the blockchain is actually active! // 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'), 'quit - ' + __('to immediatly exit (alias: exit)'), '', diff --git a/lib/modules/ipfs/index.js b/lib/modules/ipfs/index.js index d5a310708..9f8507e25 100644 --- a/lib/modules/ipfs/index.js +++ b/lib/modules/ipfs/index.js @@ -1,6 +1,8 @@ let UploadIPFS = require('./upload.js'); let utils = require('../../utils/utils.js'); let fs = require('../../core/fs.js'); +let RunCode = require('../../core/runCode.js'); +let IpfsApi = require('ipfs-api'); class IPFS { @@ -18,6 +20,7 @@ class IPFS { this.setServiceCheck(); this.addIPFSToEmbarkJS(); this.addSetProvider(); + this.addIpfsObjectToConsole(); } commandlineDeploy() { @@ -111,6 +114,12 @@ class IPFS { this.embark.addProviderInit('storage', code, shouldInit); } + + addIpfsObjectToConsole() { + let ipfs = IpfsApi(this.storageConfig.host, this.storageConfig.port); + RunCode.doEval("", {ipfs: ipfs}); + } + } module.exports = IPFS;