mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-03 09:24:25 +00:00
fix(embark/storage): fix hang when storage is disabled
This commit is contained in:
parent
4d424c06b9
commit
5e4a80edec
@ -192,7 +192,7 @@ class Engine {
|
||||
this.registerModule('code_generator', {plugins: self.plugins, env: self.env});
|
||||
|
||||
const generateCode = function (modifiedAssets) {
|
||||
self.events.request("module:storage:initiated", () => {
|
||||
self.events.request("module:storage:onReady", () => {
|
||||
self.events.request("code-generator:embarkjs:build", () => {
|
||||
self.events.emit('code-generator-ready', modifiedAssets);
|
||||
});
|
||||
@ -278,15 +278,15 @@ class Engine {
|
||||
if (!this.config.storageConfig.available_providers.includes("ipfs")) {
|
||||
return next();
|
||||
}
|
||||
this.registerModule('ipfs');
|
||||
this.events.on("ipfs:process:started", next);
|
||||
this.registerModule('ipfs');
|
||||
},
|
||||
(next) => {
|
||||
if (!this.config.storageConfig.available_providers.includes("swarm")) {
|
||||
return next();
|
||||
}
|
||||
this.registerModule('swarm');
|
||||
this.events.on("swarm:process:started", next);
|
||||
this.registerModule('swarm');
|
||||
}
|
||||
], (err) => {
|
||||
if(err) {
|
||||
|
@ -20,7 +20,10 @@ class IPFS {
|
||||
this.webServerConfig = embark.config.webServerConfig;
|
||||
this.blockchainConfig = embark.config.blockchainConfig;
|
||||
|
||||
if (this.isIpfsStorageEnabledInTheConfig()) {
|
||||
if (!this.isIpfsStorageEnabledInTheConfig()) {
|
||||
return this.events.emit("ipfs:process:started", false);
|
||||
}
|
||||
|
||||
this.setServiceCheck();
|
||||
this.registerUploadCommand();
|
||||
|
||||
@ -43,7 +46,6 @@ class IPFS {
|
||||
this.events.request('processes:launch', 'ipfs');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
downloadIpfsApi(cb) {
|
||||
this.events.request("version:get:ipfs-api", (ipfsApiVersion) => {
|
||||
|
@ -3,12 +3,24 @@ class Storage {
|
||||
this.embark = embark;
|
||||
this.storageConfig = embark.config.storageConfig;
|
||||
this.plugins = options.plugins;
|
||||
this.ready = false;
|
||||
|
||||
if (!this.storageConfig.enabled) return;
|
||||
this.embark.events.setCommandHandler("module:storage:onReady", (cb) => {
|
||||
if (this.ready) {
|
||||
return cb();
|
||||
}
|
||||
this.embark.events.once("module:storage:ready", cb);
|
||||
});
|
||||
|
||||
if (!this.storageConfig.enabled) {
|
||||
this.ready = true;
|
||||
return;
|
||||
}
|
||||
|
||||
this.handleUploadCommand();
|
||||
this.addSetProviders(() => {
|
||||
this.embark.events.setCommandHandler("module:storage:initiated", (cb) => { cb(); });
|
||||
this.ready = true;
|
||||
this.embark.events.emit("module:storage:ready");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ class Swarm {
|
||||
if (this.isSwarmEnabledInTheConfig() && cantDetermineUrl) {
|
||||
console.warn('\n===== Swarm module will not be loaded =====');
|
||||
console.warn(`Swarm is enabled in the config, however the config is not setup to provide a URL for swarm and therefore the Swarm module will not be loaded. Please either change the ${'config/storage > upload'.bold} setting to Swarm or add the Swarm config to the ${'config/storage > dappConnection'.bold} array. Please see ${'https://embark.status.im/docs/storage_configuration.html'.underline} for more information.\n`);
|
||||
return;
|
||||
return this.events.emit("swarm:process:started", false);
|
||||
}
|
||||
if (!this.isSwarmEnabledInTheConfig()) {
|
||||
this.embark.registerConsoleCommand({
|
||||
@ -36,7 +36,7 @@ class Swarm {
|
||||
cb();
|
||||
}
|
||||
});
|
||||
return;
|
||||
return this.events.emit("swarm:process:started", false);
|
||||
}
|
||||
|
||||
this.providerUrl = utils.buildUrl(this.storageConfig.upload.protocol, this.storageConfig.upload.host, this.storageConfig.upload.port);
|
||||
|
Loading…
x
Reference in New Issue
Block a user