Use defaults from config.js

This commit is contained in:
Braydon Fuller 2015-10-06 12:55:02 -04:00
parent 0b6ceeaceb
commit e476e86b7d
2 changed files with 12 additions and 13 deletions

View File

@ -34,17 +34,16 @@ var Service = function(options) {
this.node = options.node; this.node = options.node;
this.https = options.https || this.node.https; this.https = options.https || this.node.https;
this.httpsOptions = options.httpsOptions || this.node.httpsOptions; this.httpsOptions = options.httpsOptions || this.node.httpsOptions;
this.bwsPort = options.bwsPort || Service.BWS_PORT; this.bwsPort = options.bwsPort || baseConfig.port;
this.messageBrokerPort = options.messageBrokerPort || Service.MESSAGE_BROKER_PORT; this.messageBrokerPort = options.messageBrokerPort || 3380;
this.lockerPort = options.lockerPort || Service.LOCKER_PORT; if (baseConfig.lockOpts) {
this.lockerPort = baseConfig.lockOpts.lockerServer.port;
}
this.lockerPort = options.lockerPort || this.lockerPort;
}; };
util.inherits(Service, EventEmitter); util.inherits(Service, EventEmitter);
Service.BWS_PORT = 3232;
Service.MESSAGE_BROKER_PORT = 3380;
Service.LOCKER_PORT = 3231;
Service.dependencies = ['insight-api']; Service.dependencies = ['insight-api'];
/** /**

View File

@ -26,9 +26,9 @@ describe('Bitcore Node Service', function() {
key: 'key', key: 'key',
cert: 'cert' cert: 'cert'
}); });
service.bwsPort.should.equal(Service.BWS_PORT); service.bwsPort.should.equal(3232);
service.messageBrokerPort.should.equal(Service.MESSAGE_BROKER_PORT); service.messageBrokerPort.should.equal(3380);
service.lockerPort.should.equal(Service.LOCKER_PORT); service.lockerPort.should.equal(3231);
}); });
it('direct https options', function() { it('direct https options', function() {
var node = {}; var node = {};
@ -46,9 +46,9 @@ describe('Bitcore Node Service', function() {
key: 'key', key: 'key',
cert: 'cert' cert: 'cert'
}); });
service.bwsPort.should.equal(Service.BWS_PORT); service.bwsPort.should.equal(3232);
service.messageBrokerPort.should.equal(Service.MESSAGE_BROKER_PORT); service.messageBrokerPort.should.equal(3380);
service.lockerPort.should.equal(Service.LOCKER_PORT); service.lockerPort.should.equal(3231);
}); });
it('can set custom ports', function() { it('can set custom ports', function() {
var node = {}; var node = {};