From c3fc614cd88ebc6dbb5fe451a2f53d8d19ae437e Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sun, 8 Jul 2018 00:56:15 +0300 Subject: [PATCH] simplify add set providers; validation can be done on the client isde --- lib/modules/storage/index.js | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/lib/modules/storage/index.js b/lib/modules/storage/index.js index 24d91be3..d4bf9069 100644 --- a/lib/modules/storage/index.js +++ b/lib/modules/storage/index.js @@ -26,23 +26,13 @@ class Storage { }); } - /** - * Adds the code to call setProviders in embarkjs after embark is ready - * - * @returns {void} - */ addSetProviders() { const self = this; - // filter list of dapp connections based on available_providers set in config - let hasSwarm = _.contains(this.storageConfig.available_providers, 'swarm'); // don't need to eval this in every loop iteration - // contains valid dapp storage providers - this._validDappProviders = _.filter(this.storageConfig.dappConnection, (conn) => { - return _.contains(self.storageConfig.available_providers, conn.provider) || (conn === '$BZZ' && hasSwarm); - }); - let code = `\nEmbarkJS.Storage.setProviders(${JSON.stringify(this._validDappProviders)});`; + let code = `\nEmbarkJS.Storage.setProviders(${JSON.stringify(this.storageConfig.dappConnection)});`; + let shouldInit = (storageConfig) => { - return (this._validDappProviders !== undefined && this._validDappProviders.length > 0 && storageConfig.enabled === true); + return storageConfig.enabled; }; this.embark.addProviderInit('storage', code, shouldInit);