Socket
Socket
Sign inDemoInstall

@sap/xsenv

Package Overview
Dependencies
6
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.0 to 3.1.1

10

CHANGELOG.md

@@ -8,2 +8,12 @@ # Change Log

## 3.1.1 - 2021-07-01
### Fixed
- Reading services will now properly check for K8s services when VCAP_SERVICES is defined but contains no services.
- Getting a service will now properly check in K8s services if VCAP_SERVICES does not have the service.
### Updated
- `debug` dependency to 4.2.0.
- `lodash` dependency to 4.17.21.
## 3.1.0 - 2020-11-20

@@ -10,0 +20,0 @@

28

lib/xsservices.js

@@ -76,4 +76,4 @@ 'use strict';

/**
* Reads service configuration from CloudFoundry (environment variable <code>VCAP_SERVICES</code>) or mounted
* K8S secrets.
* Filters for service in service configuration from CloudFoundry (environment variable <code>VCAP_SERVICES</code>)
* or mounted K8S secrets if no results found in <code>VCAP_SERVICES</code>.
*

@@ -89,3 +89,10 @@ * @param path {string} A string containing the mount path where the secrets are located in K8S.

return serviceFilter.apply(readServices(path), filter);
let filterResults = serviceFilter.apply(readCFServices(), filter);
debug('CF Service filter with filter: %s, returned: %s.', filter, filterResults);
if (!filterResults || (filterResults && Array.isArray(filterResults) && !filterResults.length)) {
filterResults = serviceFilter.apply(readK8SServices(path), filter);
debug('K8s Service filter with filter: %s and path: %s, returned: %s.', filter, (path ? path : 'default'), filterResults);
}
return filterResults;
}

@@ -118,10 +125,17 @@

* Reads service configuration from CloudFoundry environment variable <code>VCAP_SERVICES</code>
* or mounted K8S secrets.
* or mounted K8S secrets if <code>VCAP_SERVICES</code> is empty.
*
* @param path {string} A string containing the mount path where the secrets are mounted in K8S environment.
* @return Credentials property of found service
* @throws Error in case no or multiple matching services are found
* @return Object with appropriate services or empty object if no CF or K8S services found.
* @throws Error in case bad CF json or bad path.
*/
function readServices(path) {
return readCFServices() || readK8SServices(path);
let cfServices = readCFServices();
if (cfServices && Object.keys(cfServices).length > 0) {
debug('Found VCAP_SERVICES, returning: %s', cfServices);
return cfServices;
}
let k8sServices = readK8SServices(path);
debug('Empty VCAP_SERVICES, returning K8s services: %s.', k8sServices);
return k8sServices || {};
}
{
"name": "@sap/xsenv",
"version": "3.1.0",
"version": "3.1.1",
"lockfileVersion": 1,

@@ -14,5 +14,5 @@ "requires": true,

"debug": {
"version": "3.1.0",
"version": "4.2.0",
"requires": {
"ms": "2.0.0"
"ms": "2.1.2"
}

@@ -24,3 +24,3 @@ },

"ms": {
"version": "2.0.0"
"version": "2.1.2"
},

@@ -27,0 +27,0 @@ "verror": {

{
"name": "@sap/xsenv",
"version": "3.1.0",
"version": "3.1.1",
"description": "Utility for easy setup and access of SAP HANA XS Advanced environment variables",

@@ -27,5 +27,5 @@ "repository": {},

"eslint": "3.2.2",
"filter-node-package": "^2.2.0",
"filter-node-package": "2.2.0",
"istanbul": "0.4.5",
"lodash": "4.17.11",
"lodash": "4.17.21",
"mocha": "^3.0.2",

@@ -38,5 +38,5 @@ "mock-fs": "^4.10.1",

"dependencies": {
"debug": "3.1.0",
"debug": "4.2.0",
"verror": "1.10.0"
}
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc