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

consul

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

consul - npm Package Compare versions

Comparing version 0.36.0 to 0.37.0

13

lib/agent/service.js

@@ -68,15 +68,4 @@ /**

req.body.Name = opts.name;
if (opts.id) req.body.ID = opts.id;
if (opts.tags) req.body.Tags = opts.tags;
if (opts.meta) req.body.Meta = opts.meta;
if (opts.hasOwnProperty('address')) req.body.Address = opts.address;
if (opts.hasOwnProperty('port')) req.body.Port = opts.port;
try {
if (Array.isArray(opts.checks)) {
req.body.Checks = opts.checks.map(utils.createServiceCheck);
} else if (opts.check) {
req.body.Check = utils.createServiceCheck(opts.check);
}
req.body = utils.createService(opts);
} catch (err) {

@@ -83,0 +72,0 @@ return callback(this.consul._err(errors.Validation(err.message), req));

68

lib/utils.js

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

}
if (opts.hasOwnProperty('filter') && !ignore.filter) req.query.filter = opts.filter;

@@ -291,2 +292,68 @@ // papi

function _createServiceProxy(src) {
var dst = {};
if (src.destinationservicename) {
dst.DestinationServiceName = src.destinationservicename;
} else {
throw Error('destinationservicename required');
}
if (src.destinationserviceid) dst.DestinationServiceID = src.destinationserviceid;
if (src.localserviceaddress) dst.LocalServiceAddress = src.localserviceaddress;
if (src.hasOwnProperty('localserviceport')) dst.LocalServicePort = src.localserviceport;
if (src.config) dst.Config = src.config;
if (src.upstreams) dst.Upstreams = src.upstreams;
if (src.meshgateway) dst.MeshGateway = src.meshgateway;
if (src.expose) dst.Expose = src.expose;
return dst;
}
function _createService(src, isSidecar) {
var dst = {};
if (src.name) dst.Name = src.name;
if (src.id) dst.ID = src.id;
if (src.tags) dst.Tags = src.tags;
if (src.meta) dst.Meta = src.meta;
if (src.hasOwnProperty('address')) dst.Address = src.address;
if (src.hasOwnProperty('port')) dst.Port = src.port;
if (Array.isArray(src.checks)) {
dst.Checks = src.checks.map(createServiceCheck);
} else if (src.check) {
dst.Check = createServiceCheck(src.check);
}
if (src.connect) {
var connect = normalizeKeys(src.connect);
dst.Connect = {};
if (connect.hasOwnProperty('native')) dst.Connect.Native = connect.native;
if (connect.proxy) {
dst.Connect.Proxy = _createServiceProxy(normalizeKeys(connect.proxy));
}
if (connect.sidecarservice) {
if (!isSidecar) {
dst.Connect.SidecarService = _createService(
normalizeKeys(connect.sidecarservice), true);
} else {
throw new Error('sidecarservice cannot be nested');
}
}
}
if (src.proxy) {
dst.Proxy = _createServiceProxy(normalizeKeys(src.proxy));
}
return dst;
}
function createService(src) {
return _createService(normalizeKeys(src));
}
/**

@@ -369,4 +436,5 @@ * Create standalone check object

exports.createServiceCheck = createServiceCheck;
exports.createService = createService;
exports.createCheck = createCheck;
exports.hasIndexChanged = hasIndexChanged;
exports.parseQueryMeta = parseQueryMeta;
{
"name": "consul",
"version": "0.36.0",
"version": "0.37.0",
"description": "Consul client",

@@ -5,0 +5,0 @@ "main": "./lib",

@@ -83,2 +83,3 @@ # Consul

* node-meta (String[], optional): used to specify a desired node metadata key/value pair of the form key:value
* filter (String, optional): used to [refine a data query](https://www.consul.io/api/features/filtering.html) for some API listing endpoints

@@ -736,2 +737,4 @@ These options work for all methods.

* checks (Object[], optional): service checks (see `check` above)
* connect (Object, optional): specifies the [configuration](https://www.consul.io/api/agent/service.html#connect-structure) for Connect
* proxy (Object, optional): specifies the [configuration](https://www.consul.io/docs/connect/registration/service-registration.html) for a Connect proxy instance

@@ -738,0 +741,0 @@ Usage

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