Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-ral

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-ral - npm Package Compare versions

Comparing version 0.14.0 to 0.15.0

1

lib/config.js

@@ -108,2 +108,3 @@ /**

should(serviceInfo, 'portOffset').to.be.a('number');
should(serviceInfo, 'retry').to.be.a('number').at.least(0);

@@ -110,0 +111,0 @@ should(serviceInfo, 'timeout').to.be.a('number').at.least(1);

@@ -21,2 +21,3 @@ /**

unpack: 'string',
portOffset: 0,
path: '/'

@@ -33,3 +34,3 @@ };

// inherit default config
_.map(defaultServiceInfo, function (value, key) {
_.forEach(defaultServiceInfo, function (value, key) {
if (config.hasOwnProperty(key) === false) {

@@ -41,2 +42,10 @@ config[key] = value;

config.timeout = Math.ceil(config.timeout);
// apply port offset to server port
_.forEach(config.server, function (server) {
// default server port
if (server.port === undefined || server.port === null) {
server.port = 80;
}
server.port = server.port + config.portOffset;
});
return config;

@@ -43,0 +52,0 @@ };

6

package.json
{
"name": "node-ral",
"version": "0.14.0",
"version": "0.15.0",
"description": "a rpc client for node",

@@ -42,3 +42,3 @@ "main": "index.js",

"devDependencies": {
"request": "2.74.0",
"request": "2.75.0",
"async": "2.0.1",

@@ -48,5 +48,5 @@ "combined-stream": "1.0.5",

"istanbul": "0.4.5",
"mocha": "3.0.2",
"mocha": "3.1.0",
"should": "11.1.0"
}
}

@@ -76,5 +76,4 @@ /**

var wrongConf = require('./config/wrong_config.js').withoutPort;
(function () {
config.loadRawConf(wrongConf);
}).should.throw(/port/);
var conf = config.loadRawConf(wrongConf);
conf.bookServiceBNS.server[0].port.should.be.equal(80);
});

@@ -88,2 +87,9 @@

});
it('loadRawConf config with portOffset', function () {
var rightConf = require('./config/right_config.js');
var conf = config.loadRawConf(rightConf);
conf.withPortOffset.server[0].port.should.be.equal(90);
conf.withPortOffset.server[1].port.should.be.equal(80);
});
});

@@ -90,0 +96,0 @@

@@ -11,2 +11,19 @@ /**

module.exports = {
withPortOffset: {
unpack: 'json',
pack: 'json',
// 指定服务端交互的编码格式,由于Node.js环境只支持UTF-8,因此yog-ral会自动进行转码工作
encoding: 'GBK',
balance: 'random',
protocol: 'http',
portOffset: 10,
server: [{
host: 'st.yd.baidu.com',
idc: 'st'
}, {
host: 'tc.yd.baidu.com',
port: 70,
idc: 'tc'
}]
},
bookService: {

@@ -13,0 +30,0 @@ unpack: 'json',

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc