npm.io
1.1.1 • Published 9 years ago

is-cf

Licence
MIT
Version
1.1.1
Deps
1
Vulns
0
Weekly
0

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