move storage config check to the constructor
This commit is contained in:
parent
d5f77fb965
commit
aaf127fd1d
|
@ -17,6 +17,10 @@ class IPFS {
|
|||
this.webServerConfig = embark.config.webServerConfig;
|
||||
this.blockchainConfig = embark.config.blockchainConfig;
|
||||
|
||||
if (!this.isIpfsEnabledInTheConfig()) {
|
||||
return
|
||||
}
|
||||
|
||||
this.setServiceCheck();
|
||||
this.addProviderToEmbarkJS();
|
||||
this.addObjectToConsole();
|
||||
|
@ -34,10 +38,6 @@ class IPFS {
|
|||
setServiceCheck() {
|
||||
let self = this;
|
||||
|
||||
if (!this.isIpfsEnabledInTheConfig()) {
|
||||
return
|
||||
}
|
||||
|
||||
self.events.on('check:backOnline:IPFS', function () {
|
||||
self.logger.info(__('IPFS node detected') + '..');
|
||||
});
|
||||
|
@ -83,9 +83,6 @@ class IPFS {
|
|||
|
||||
addProviderToEmbarkJS() {
|
||||
const self = this;
|
||||
if (!this.isIpfsEnabledInTheConfig()) {
|
||||
return
|
||||
}
|
||||
|
||||
self.events.request("version:get:ipfs-api", function(ipfsApiVersion) {
|
||||
let currentIpfsApiVersion = require('../../../package.json').dependencies["ipfs-api"];
|
||||
|
|
|
@ -22,6 +22,10 @@ class Swarm {
|
|||
|
||||
this.getUrl = this.storageConfig.upload.getUrl || this.providerUrl + '/bzz:/';
|
||||
|
||||
if (!this.isSwarmEnabledInTheConfig()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.bzz = new Web3Bzz(this.providerUrl);
|
||||
|
||||
this.setServiceCheck();
|
||||
|
@ -41,10 +45,6 @@ class Swarm {
|
|||
setServiceCheck() {
|
||||
let self = this;
|
||||
|
||||
if (!this.isSwarmEnabledInTheConfig()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.events.on('check:backOnline:Swarm', function () {
|
||||
self.logger.info(__('Swarm node detected...'));
|
||||
});
|
||||
|
@ -73,10 +73,6 @@ class Swarm {
|
|||
}
|
||||
|
||||
addProviderToEmbarkJS() {
|
||||
if (!this.isSwarmEnabledInTheConfig()) {
|
||||
return;
|
||||
}
|
||||
|
||||
let code = "";
|
||||
code += "\n" + fs.readFileSync(utils.joinPath(__dirname, 'embarkjs.js')).toString();
|
||||
code += "\nEmbarkJS.Storage.registerProvider('swarm', __embarkSwarm);";
|
||||
|
|
Loading…
Reference in New Issue