Socket
Socket
Sign inDemoInstall

vcap_services

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vcap_services

Parse and return service credentials from VCAP_SERVICES.


Version published
Weekly downloads
3.1K
decreased by-6.52%
Maintainers
1
Weekly downloads
 
Created
Source

VCAP_SERVICES

Build Status Coverage Status npm-version npm-downloads

Parse and return service credentials from VCAP_SERVICES environment variable that Bluemix provides.

Installation

$ npm install vcap_services --save

Usage

var vcapServices = require('vcap_services');
var credentials = vcapServices.getCredentials('personality_insights');
console.log(credentials);

If VCAP_SERVICES is:

{
  "personality_insights": [{
      "credentials": {
        "password": "<password>",
        "url": "<url>",
        "username": "<username>"
      },
    "label": "personality_insights",
    "name": "personality-insights-service",
    "plan": "standard"
  }]
}

Output:

{
  "password": "<password>",
  "url": "<url>",
  "username": "<username>"
}

Getting credentials for a specific plan

Get credentials that match a specific service plan (only for VCAP_SERVICES).

var vcapServices = require('vcap_services');
var credentials = vcapServices.getCredentials('personality_insights', 'standard');
console.log(credentials);

Getting credentials for a specific instance

Get credentials that match a specific service instance (replace "YOUR NLC NAME" with the name of your service instance).

var vcapServices = require('vcap_services');
var credentials = vcapServices.getCredentials('natural_language_classifier', null, 'YOUR NLC NAME');
console.log(credentials);

Getting credentials for a specific plan and instance

Get credentials that match a specific service plan and instance (replace "YOUR NLC NAME" with the name of your service instance).

var vcapServices = require('vcap_services');
var credentials = vcapServices.getCredentials('natural_language_classifier', 'standard', 'YOUR NLC NAME');
console.log(credentials);

Tests

Running all the tests:

$ npm test

Running a specific test:

$ mocha -g '<test name>'

License

MIT.

Contributing

See CONTRIBUTING.

Keywords

FAQs

Package last updated on 13 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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