fix: swarm command registers and warns when swarm is disabled

This commit is contained in:
Andre Medeiros 2019-01-22 12:44:38 -05:00 committed by Iuri Matias
parent e36ea5d24d
commit afe2512eff
1 changed files with 9 additions and 2 deletions

View File

@ -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`);
} 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();
}
if (!this.isSwarmEnabledInTheConfig() || cantDetermineUrl) {
});
return;
}