simulator -- defaultHost, dockerHostSwap

This commit is contained in:
Michael Bradley, Jr 2018-07-15 10:12:18 -05:00 committed by Pascal Precht
parent 4cebee8f92
commit f4b6dd420d
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 2 additions and 1 deletions

View File

@ -3,6 +3,7 @@ let shelljs = require('shelljs');
let proxy = require('../core/proxy'); let proxy = require('../core/proxy');
const Ipc = require('../core/ipc'); const Ipc = require('../core/ipc');
const constants = require('../constants.json'); const constants = require('../constants.json');
const {defaultHost, dockerHostSwap} = require('../utils/host');
class Simulator { class Simulator {
constructor(options) { constructor(options) {
@ -16,7 +17,7 @@ class Simulator {
const ganache = path.join(__dirname, '../../node_modules/.bin/ganache-cli'); const ganache = path.join(__dirname, '../../node_modules/.bin/ganache-cli');
let useProxy = this.blockchainConfig.proxy || false; let useProxy = this.blockchainConfig.proxy || false;
let host = (options.host || this.blockchainConfig.rpcHost || 'localhost'); let host = (dockerHostSwap(options.host || this.blockchainConfig.rpcHost) || defaultHost);
let port = (options.port || this.blockchainConfig.rpcPort || 8545); let port = (options.port || this.blockchainConfig.rpcPort || 8545);
cmds.push("-p " + (port + (useProxy ? constants.blockchain.servicePortOnProxy : 0))); cmds.push("-p " + (port + (useProxy ? constants.blockchain.servicePortOnProxy : 0)));