mirror of https://github.com/embarklabs/embark.git
remove unneded assignments
This commit is contained in:
parent
9f05c43329
commit
8720f43e39
|
@ -6,16 +6,10 @@ const SwarmModule = require('../swarm');
|
||||||
class Storage {
|
class Storage {
|
||||||
constructor(embark, options){
|
constructor(embark, options){
|
||||||
const self = this;
|
const self = this;
|
||||||
this._embark = embark;
|
this.embark = embark;
|
||||||
this._options = options;
|
this.storageConfig = embark.config.storageConfig;
|
||||||
this._storageConfig = options.storageConfig;
|
|
||||||
this._webServerConfig = options.webServerConfig;
|
|
||||||
this._blockchainConfig = options.blockchainConfig;
|
|
||||||
this._servicesMonitor = options.servicesMonitor;
|
|
||||||
this._events = options.events;
|
|
||||||
this._logger = options.logger;
|
|
||||||
|
|
||||||
if (!this._storageConfig.enabled) return;
|
if (!this.storageConfig.enabled) return;
|
||||||
|
|
||||||
this.addSetProviders();
|
this.addSetProviders();
|
||||||
|
|
||||||
|
@ -38,10 +32,10 @@ class Storage {
|
||||||
*/
|
*/
|
||||||
addSetProviders() {
|
addSetProviders() {
|
||||||
// filter list of dapp connections based on available_providers set in config
|
// 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
|
let hasSwarm = _.contains(this.storageConfig.available_providers, 'swarm'); // don't need to eval this in every loop iteration
|
||||||
// contains valid dapp storage providers
|
// contains valid dapp storage providers
|
||||||
this._validDappProviders = _.filter(this._storageConfig.dappConnection, (conn) => {
|
this._validDappProviders = _.filter(this.storageConfig.dappConnection, (conn) => {
|
||||||
return _.contains(self._storageConfig.available_providers, conn.provider) || (conn === '$BZZ' && hasSwarm);
|
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._validDappProviders)});`;
|
||||||
|
@ -49,7 +43,7 @@ class Storage {
|
||||||
return (this._validDappProviders !== undefined && this._validDappProviders.length > 0 && storageConfig.enabled === true);
|
return (this._validDappProviders !== undefined && this._validDappProviders.length > 0 && storageConfig.enabled === true);
|
||||||
};
|
};
|
||||||
|
|
||||||
this._embark.addProviderInit('storage', code, shouldInit);
|
this.embark.addProviderInit('storage', code, shouldInit);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue