fix(blockchain): fix setting proxy to false not applying

This commit is contained in:
Jonathan Rainville 2018-11-06 14:31:52 -05:00
parent c25c644b5a
commit f50f106e07
4 changed files with 8 additions and 7 deletions

View File

@ -208,7 +208,8 @@ Config.prototype.loadBlockchainConfigFile = function() {
"default": { "default": {
"enabled": true, "enabled": true,
"rpcCorsDomain": "auto", "rpcCorsDomain": "auto",
"wsOrigins": "auto" "wsOrigins": "auto",
"proxy": true
} }
}; };

View File

@ -12,7 +12,7 @@ const Ipc = require('../../core/ipc');
const {defaultHost, dockerHostSwap} = require('../../utils/host'); const {defaultHost, dockerHostSwap} = require('../../utils/host');
const Logger = require('../../core/logger'); const Logger = require('../../core/logger');
// time between IPC connection attmpts (in ms) // time between IPC connection attempts (in ms)
const IPC_CONNECT_INTERVAL = 2000; const IPC_CONNECT_INTERVAL = 2000;
/*eslint complexity: ["error", 42]*/ /*eslint complexity: ["error", 42]*/
@ -60,7 +60,7 @@ var Blockchain = function(userConfig, clientClass) {
targetGasLimit: this.userConfig.targetGasLimit || false, targetGasLimit: this.userConfig.targetGasLimit || false,
syncMode: this.userConfig.syncMode || this.userConfig.syncmode, syncMode: this.userConfig.syncMode || this.userConfig.syncmode,
verbosity: this.userConfig.verbosity, verbosity: this.userConfig.verbosity,
proxy: this.userConfig.proxy || true proxy: this.userConfig.proxy
}; };
if (this.userConfig === {} || this.userConfig.default || JSON.stringify(this.userConfig) === '{"enabled":true}') { if (this.userConfig === {} || this.userConfig.default || JSON.stringify(this.userConfig) === '{"enabled":true}') {

View File

@ -41,12 +41,9 @@ describe('embark.Blockchain', function() {
targetGasLimit: false, targetGasLimit: false,
syncMode: undefined, syncMode: undefined,
verbosity: undefined, verbosity: undefined,
proxy: true, proxy: undefined,
silent: undefined silent: undefined
}; };
// We check also proxy's ports because proxy is set to true
expectedConfig.wsPort += constants.blockchain.servicePortOnProxy;
expectedConfig.rpcPort += constants.blockchain.servicePortOnProxy;
assert.deepEqual(blockchain.config, expectedConfig); assert.deepEqual(blockchain.config, expectedConfig);
done(); done();

View File

@ -25,6 +25,7 @@ describe('embark.Config', function () {
"isDev": false, "isDev": false,
"mineWhenNeeded": true, "mineWhenNeeded": true,
"nodiscover": true, "nodiscover": true,
"proxy": true,
"rpcHost": "localhost", "rpcHost": "localhost",
"rpcPort": 8545, "rpcPort": 8545,
"rpcCorsDomain": "http://localhost:8000", "rpcCorsDomain": "http://localhost:8000",
@ -48,6 +49,7 @@ describe('embark.Config', function () {
"gasPrice": "8000000", "gasPrice": "8000000",
"mineWhenNeeded": true, "mineWhenNeeded": true,
"nodiscover": true, "nodiscover": true,
"proxy": true,
"rpcHost": "localhost", "rpcHost": "localhost",
"rpcPort": 8545, "rpcPort": 8545,
"rpcCorsDomain": "http://localhost:8000", "rpcCorsDomain": "http://localhost:8000",
@ -81,6 +83,7 @@ describe('embark.Config', function () {
"gasPrice": "8000000", "gasPrice": "8000000",
"mineWhenNeeded": true, "mineWhenNeeded": true,
"nodiscover": true, "nodiscover": true,
"proxy": true,
"rpcHost": "localhost", "rpcHost": "localhost",
"rpcPort": 8545, "rpcPort": 8545,
"rpcCorsDomain": "http://localhost:8000", "rpcCorsDomain": "http://localhost:8000",