use deployment config from contracts.json instead of blockchain.json

This commit is contained in:
Iuri Matias 2017-07-05 20:24:28 -04:00
parent 408090a643
commit f882b3486b
3 changed files with 15 additions and 4 deletions

View File

@ -75,7 +75,13 @@ Config.prototype.loadBlockchainConfigFile = function() {
Config.prototype.loadContractsConfigFile = function() {
var configObject = {};
var configObject = {
"deployment": {
"host": "localhost",
"port": 8545,
"type": "rpc"
}
};
var configPlugins = this.plugins.getPluginsFor('contractsConfig');
if (configPlugins.length > 0) {

View File

@ -220,8 +220,12 @@ class Engine {
this.web3 = options.web3;
if (this.web3 === undefined) {
this.web3 = new Web3();
let web3Endpoint = 'http://' + this.config.blockchainConfig.rpcHost + ':' + this.config.blockchainConfig.rpcPort;
this.web3.setProvider(new this.web3.providers.HttpProvider(web3Endpoint));
if (this.config.contractsConfig.deployment.type === "rpc") {
let web3Endpoint = 'http://' + this.config.contractsConfig.deployment.host + ':' + this.config.contractsConfig.deployment.port;
this.web3.setProvider(new this.web3.providers.HttpProvider(web3Endpoint));
} else {
throw new Error("contracts config error: unknown deployment type " + this.config.contractsConfig.deployment.type);
}
}
self.servicesMonitor.addCheck('Ethereum', function (cb) {

View File

@ -6,7 +6,8 @@
},
"deployment": {
"host": "localhost",
"port": 8545
"port": 8545,
"type": "rpc"
},
"dappConnection": [
"$WEB3",