is-cf
v1.1.1
Published
Cloud Foundry environment detection and helpers.
Downloads
3
Readme
is-cf
Cloud Foundry environment detection and helpers.
Installation
npm install --save is-cf
Usage
var isCF = require('is-cf');
if (isCF.env()) {
// Running on a Cloud Foundry
if (isCF.getService('p-redis')) {
// Service 'p-redis' is bound, do stuff
}
}
API
env()
Determines Cloud Foundry presence using environment variables, returns a boolean
getAppEnv()
Returns VCAP_APPLICATION environment variable as an object
getServicesEnv()
Returns VCAP_SERVICES environment variable as an object
getService(name)
Returns environment metadata for service 'name' as an array, or null if service 'name' not found
getServiceInstance(serviceName, instanceName)
Returns environment metadata for service instance 'name' as an object, or null if service instance 'name' not found