VCAP_SERVICES

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 an specific service plan.
var vcapServices = require('vcap_services');
var credentials = vcapServices.getCredentials('personality_insights', 'standard');
console.log(credentials);
Tests
Running all the tests:
$ npm test
Running a specific test:
$ mocha -g '<test name>'
License
MIT.
Contributing
See CONTRIBUTING.