Skip to content

Commit afe2512

Browse files
Andre Medeirosiurimatias
authored andcommitted
fix: swarm command registers and warns when swarm is disabled
1 parent e36ea5d commit afe2512

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/lib/modules/swarm/index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,15 @@ class Swarm {
2626
if(this.isSwarmEnabledInTheConfig() && cantDetermineUrl){
2727
console.warn('\n===== Swarm module will not be loaded =====');
2828
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`);
29-
}
30-
if (!this.isSwarmEnabledInTheConfig() || cantDetermineUrl) {
29+
} else {
30+
this.embark.registerConsoleCommand({
31+
matches: cmd => cmd === "swarm" || cmd.indexOf('swarm ') === 0,
32+
process: (_cmd, cb) => {
33+
console.warn(__(`Swarm is disabled or not configured. Please see %s for more information.`, 'https://embark.status.im/docs/storage_configuration.html'.underline));
34+
cb();
35+
}
36+
});
37+
3138
return;
3239
}
3340

0 commit comments

Comments
 (0)