Add support to locally conifgure web3 provider

If no web3 is provided from the browser we check if a
config:web3ProviderUrl item is set in localstorage.
If yes we connect to that provider otherwise use the default config.
Helpful for working simultanously with different chains and providers.
This commit is contained in:
2017-05-14 12:37:47 +02:00
parent f57e90941c
commit 7299394809
+2 -1
View File
@@ -25,7 +25,8 @@ export default Ember.Service.extend({
this.set('web3Provided', true);
} else {
Ember.Logger.debug('[kredits] Creating new instance from npm module class');
let provider = new Web3.providers.HttpProvider(config.web3ProviderUrl);
let providerUrl = localStorage.getItem('config:web3ProviderUrl') || config.web3ProviderUrl;
let provider = new Web3.providers.HttpProvider(providerUrl);
web3Instance = new Web3(provider);
}