fix(simulator): change port depending of the type in config

This commit is contained in:
Jonathan Rainville 2018-11-08 17:11:45 -05:00 committed by Iuri Matias
parent f90194703e
commit 51e39c5b74
2 changed files with 4 additions and 1 deletions

View File

@ -40,6 +40,7 @@ class EmbarkController {
let Simulator = require('../lib/modules/blockchain_process/simulator.js');
let simulator = new Simulator({
blockchainConfig: this.config.blockchainConfig,
contractsConfig: this.config.contractsConfig,
logger: this.logger
});
simulator.run(options);

View File

@ -10,6 +10,7 @@ const fs = require('../../core/fs.js');
class Simulator {
constructor(options) {
this.blockchainConfig = options.blockchainConfig;
this.contractsConfig = options.contractsConfig;
this.logger = options.logger;
}
@ -30,7 +31,8 @@ class Simulator {
let useProxy = this.blockchainConfig.proxy || false;
let host = (dockerHostSwap(options.host || this.blockchainConfig.rpcHost) || defaultHost);
let port = (options.port || this.blockchainConfig.rpcPort || 8545);
const configPort = this.contractsConfig.deployment.type === 'rpc' ? this.blockchainConfig.rpcPort : this.blockchainConfig.wsPort;
let port = (options.port || configPort || 8545);
port = parseInt(port, 10) + (useProxy ? constants.blockchain.servicePortOnProxy : 0);
cmds.push("-p " + port);