From afe2512effbe540b6443ec0a6910ed0c821d50e9 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Tue, 22 Jan 2019 12:44:38 -0500 Subject: [PATCH] fix: swarm command registers and warns when swarm is disabled --- src/lib/modules/swarm/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib/modules/swarm/index.js b/src/lib/modules/swarm/index.js index df1f60f31..20da90a43 100644 --- a/src/lib/modules/swarm/index.js +++ b/src/lib/modules/swarm/index.js @@ -26,8 +26,15 @@ 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`); - } - if (!this.isSwarmEnabledInTheConfig() || cantDetermineUrl) { + } else { + this.embark.registerConsoleCommand({ + matches: cmd => cmd === "swarm" || cmd.indexOf('swarm ') === 0, + process: (_cmd, cb) => { + console.warn(__(`Swarm is disabled or not configured. Please see %s for more information.`, 'https://embark.status.im/docs/storage_configuration.html'.underline)); + cb(); + } + }); + return; }