anchor.diff:        ]
       }
   
  -Based on this `VCAP_SERVICES`, CF creates the following
  -`DATABASE_URL` environment variable:
  +Based on this `VCAP_SERVICES`, CF creates the following `DATABASE_URL` environment variable:
   
       DATABASE_URL = postgres://exampleuser:examplepass@babar.elephantsql.com:5432/exampledb
   
  -### <a id='HOME'></a>HOME ###
  +For more information, see [VCAP_SERVICES](#VCAP-SERVICES).
  +
  +### <a id='HOME'></a> HOME
  +
   Root folder for the deployed app.
   
   Example: `HOME=/home/vcap/app`
   
  -### <a id='LANG'></a>LANG ###
  +### <a id='LANG'></a> LANG
  +
   LANG is required by buildpacks to ensure consistent script load order.
   
   Example: `LANG=en_US.UTF-8`
   
  -### <a id='memory'></a>MEMORY_LIMIT ###
  -The maximum amount of memory that each instance of the app can consume.
  -You specify this value in an app manifest or with the cf CLI when
  -pushing an app.
  -The value is limited by space and org quotas.
  -
  -If an instance exceeds the maximum limit, it will be restarted.
  -If Cloud Foundry is asked to restart an instance too frequently, the instance will instead be terminated.
  +### <a id='memory'></a> MEMORY_LIMIT
  +
  +The maximum amount of memory that each instance of the app can consume. You specify this value in an app manifest or with the cf CLI when pushing an app. The value is limited by space and org quotas.
  +
  +If an instance exceeds the maximum limit, it is restarted. If CF is asked to restart an instance too frequently, the instance is terminated.
   
   Example: `MEMORY_LIMIT=512M`
   
  -### <a id='PORT'></a>PORT ###
  -
  -The port on which the app should listen for requests.
  -The Cloud Foundry runtime allocates a port dynamically for each instance of the
  -app, so code that obtains or uses the app port should refer to
  -it using the `PORT` environment variable.
  +### <a id='PORT'></a> PORT
  +
  +The port on which the app should listen for requests. The CF runtime allocates a port dynamically for each instance of the app, so code that obtains or uses the app port should refer to it using the `PORT` environment variable.
   
   Example: `PORT=8080`
   
  -### <a id='PWD'></a>PWD ###
  -Identifies the present working directory, where the buildpack that processed
  -the app ran.
  +### <a id='PWD'></a> PWD
  +
  +Identifies the present working directory, where the buildpack that processed the app ran.
   
   Example: `PWD=/home/vcap/app`
   
  -### <a id='TMPDIR'></a>TMPDIR###
  +### <a id='TMPDIR'></a> TMPDIR
  +
   Directory location where temporary and staging files are stored.
   
   Example: `TMPDIR=/home/vcap/tmp`
   
  -### <a id='USER'></a>USER###
  +### <a id='USER'></a> USER
  +
   The user account under which the app runs.
   
   Example: `USER=vcap`
   
  -### <a id='VCAP-APP-PORT'></a>VCAP\_APP\_PORT ###
  -
  -Deprecated name for the [PORT](#PORT) variable defined above.
  -
  -### <a id='VCAP-APPLICATION'></a>VCAP_APPLICATION ###
  -
  -This variable contains the associated attributes for a deployed app.
  -Results are returned in JSON format.
  -The table below lists the attributes that are returned.
  -
  -<table border="1" class="nice">
  -  <tr>
  -    <th>Attribute</th>
  -    <th>Description</th>
  -  </tr>
  -  <tr>
  -    <td><code>application_id</code></td>
  -    <td>GUID identifying the app.</td>
  -  </tr>
  -  <tr>
  -    <td><code>application_name</code></td>
  -    <td>The name assigned to the app when it was pushed.</td>
  -  </tr>
  -  <tr>
  -    <td><code>application_uris</code></td>
  -    <td>The URIs assigned to the app.</td>
  -  </tr>
  -  <tr>
  -    <td><code>application_version</code></td>
  -    <td>GUID identifying a version of the app. Each time an app is pushed or restarted, this value is updated.</td>
  -  </tr>
  -  <tr>
  -    <td><code>cf_api</code></td>
  -    <td>Location of the Cloud Controller API for the CF Deployment where the app runs.</td>
  -  </tr>
  -  <tr>
  -    <td><code>host</code></td>
  -    <td>Deprecated. IP address of the app instance. </td>
  -  </tr>
  -  <tr>
  -    <td><code>limits</code></td>
  -    <td>The limits to disk space, number of files, and memory permitted to the app. Memory and disk space limits are supplied when the app is deployed, either on the command line or in the app manifest. The number of files allowed is operator-defined.</td>
  -  </tr>
  -  <tr>
  -    <td><code>name</code></td>
  -    <td>Identical to <code>application_name</code>.</td>
  -  </tr>
  -  <tr>
  -    <td><code>organization_id</code></td>
  -    <td>GUID identifying the org where the app is deployed.</td>
  -  </tr>
  -  <tr>
  -    <td><code>organization_name</code></td>
  -    <td>Human-readable name of the org where the app is deployed.</td>
  -  </tr>
  -  <tr>
  -    <td><code>process_id</code></td>
  -    <td>GUID identifying the process.  Only present in running app containers.</td>
  -  </tr>
  -  <tr>
  -    <td><code>process_type</code></td>
  -    <td>Type of process.  Only present in running app containers.</td>
  -  </tr>
  -  <tr>
  -    <td><code>space_id</code></td>
  -    <td>GUID identifying the space where the app is deployed.</td>
  -  </tr>
  -  <tr>
  -    <td><code>space_name</code></td>
  -    <td>Human-readable name of the space where the app is deployed.</td>
  -  </tr>
  -  <tr>
  -    <td><code>start</code></td>
  -    <td>Human-readable timestamp for the time the instance was started. Not provided on Diego Cells.</td>
  -  </tr>
  -  <tr>
  -    <td><code>started_at</code></td>
  -    <td>Identical to <code>start</code>. Not provided on Diego Cells.</td>
  -  </tr>
  -  <tr>
  -    <td><code>started_at_timestamp</code></td>
  -    <td>Unix epoch timestamp for the time the instance was started. Not provided on Diego Cells.</td>
  -  </tr>
  -  <tr>
  -    <td><code>state_timestamp</code></td>
  -    <td>Identical to <code>started_at_timestamp</code>. Not provided on Diego Cells.</td>
  -  </tr>
  -  <tr>
  -    <td><code>uris</code></td>
  -    <td>Identical to <code>application_uris</code>. You must ensure that both <code>application_uris</code> and <code>uris</code> are set to the same value.</td>
  -  </tr>
  -  <tr>
  -    <td><code>users</code></td>
  -    <td>Deprecated. Not provided on Diego Cells.</td>
  -  </tr>
  -  <tr>
  -    <td><code>version</code></td>
  -    <td>Identical to <code>application_version</code>.</td>
  -  </tr>
  -</table>
  -
  -
  -### <a id='VCAP-SERVICES'></a>VCAP\_SERVICES ###
  -
  -For [bindable services](../services/), Cloud Foundry adds connection details to
  -the `VCAP_SERVICES` environment variable when you restart your app,
  -after binding a service instance to your app.
  -
  -The results are returned as a JSON document that contains an object for each
  -service for which one or more instances are bound to the app.
  -The service object contains a child object for each service instance of that
  -service that is bound to the app.
  -The attributes that describe a bound service are defined in the table below.
  -
  -The key for each service in the JSON document is the same as the value of the
  -"label" attribute.
  -
  -<table border="1" class="nice">
  -  <tr>
  -    <th>Attribute</th>
  -    <th>Description</th>
  -  </tr>
  -  <tr>
  -    <td><code>binding_name</code></td>
  -    <td>The name assigned to the service binding by the user.</td>
  -  </tr>
  -  <tr>
  -    <td><code>instance_name</code></td>
  -    <td>The name assigned to the service instance by the user.</td>
  -  </tr>
  -  <tr>
  -    <td><code>name</code></td>
  -   <td>The <code>binding_name</code> if it exists; otherwise the <code>instance_name</code>.</td>
  -  </tr>
  -  <tr>
  -    <td><code>label</code></td>
  -    <td>The name of the service offering.</td>
  -  </tr>
  -  <tr>
  -    <td><code>tags</code></td>
  -    <td>An array of strings an app can use to identify a service instance.</td>
  -  </tr>
  -  <tr>
  -    <td><code>plan</code></td>
  -    <td>The service plan selected when the service instance was created.</td>
  -  </tr>
  -  <tr>
  -    <td><code>credentials</code></td>
  -    <td>A JSON object containing the service-specific credentials needed to access the service instance.</td>
  -  </tr>
  -</table>
  -
  -To see the value of VCAP\_SERVICES for an app pushed to Cloud Foundry,
  -see [View Environment Variable Values](#view-env).
  -
  -The example below shows the value of VCAP_SERVICES for bound instances of several services available in the
  -[Pivotal Web Services](http://run.pivotal.io) Marketplace.
  +### <a id='VCAP-APP-PORT'></a> VCAP\_APP\_PORT
  +
  +Deprecated name for the PORT variable.
  +
  +### <a id='VCAP-APPLICATION'></a> VCAP_APPLICATION
  +
  +This variable contains the associated attributes for a deployed app. Results are returned in JSON format. The table below lists the attributes that are returned.
  +
  +| Attribute | Description |
  +| --------- | ----------- |
  +| `application_id` | GUID identifying the app. |
  +| `application_name` | The name assigned to the app when it was pushed. |
  +| `application_uris` | The URIs assigned to the app. |
  +| `application_version` | GUID identifying a version of the app. Each time an app is pushed or restarted, this value is updated. |
  +| `cf_api` | Location of the Cloud Controller API for the CF Deployment where the app runs. |
  +| `host` | Deprecated. IP address of the app instance. |
  +| `limits` | The limits to disk space, number of files, and memory permitted to the app. Memory and disk space limits are supplied when the app is deployed, either on the command line or in the app manifest. The number of files allowed is operator-defined. |
  +| `name` | Identical to `application_name`. |
  +| `organization_id` | GUID identifying the org where the app is deployed. |
  +| `organization_name` | Human-readable name of the org where the app is deployed. |
  +| `process_id` | UID identifying the process. Only present in running app containers. |
  +| `process_type` | Type of process. Only present in running app containers. |
  +| `space_id` | GUID identifying the space where the app is deployed. |
  +| `space_name` | Human-readable name of the space where the app is deployed. |
  +| `start` | Human-readable timestamp for the time the instance was started. Not provided on Diego Cells. |
  +| `started_at` | Identical to `start`. Not provided on Diego Cells. |
  +| `started_at_timestamp` | Unix epoch timestamp for the time the instance was started. Not provided on Diego Cells. |
  +| `state_timestamp` | Identical to `started_at_timestamp`. Not provided on Diego Cells. |
  +| `uris` | Identical to `application_uris`. You must ensure that both `application_uris` and `uris` are set to the same value. |
  +| `users` | Deprecated. Not provided on Diego Cells. |
  +| `version` | Identical to `application_version`. |
  +
  +### <a id='VCAP-SERVICES'></a> VCAP\_SERVICES
  +
  +For bindable services, CF adds connection details to the `VCAP_SERVICES` environment variable when you restart your app, after binding a service instance to your app. For more information about bindable services, see [Services Overview](../services/).
  +
  +The results are returned as a JSON document that contains an object for each service for which one or more instances are bound to the app. The service object contains a child object for each service instance of that service that is bound to the app. The attributes that describe a bound service are defined in the table below.
  +
  +The key for each service in the JSON document is the same as the value of the "label" attribute.
  +
  +| Attribute | Description |
  +| --------- | ----------- |
  +| `binding_name` | The name assigned to the service binding by the user. |
  +| `instance_name` | The name assigned to the service instance by the user. |
  +| `name` | The `binding_name` if it exists; otherwise the `instance_name`. |
  +| `label` | The name of the service offering. |
  +| `tags` | An array of strings an app can use to identify a service instance. |
  +| `plan` | The service plan selected when the service instance was created. |
  +| `credentials` | A JSON object containing the service-specific credentials needed to access the service instance. |
  +
  +To see the value of VCAP\_SERVICES for an app pushed to CF, see [View Environment Variable Values](#view-env).
  +
  +The example below shows the value of VCAP_SERVICES for bound instances of several services available in the Pivotal Web Services Marketplace.
   
   ~~~
   VCAP_SERVICES=
  
positive.code: MY_ENV_VARIABLE: 100
  </pre>
  
  ## <a id='app-system-env'></a>App-Specific System Variables ##
  
  The subsections that follow describe the environment variables that Cloud
  Foundry makes available to your app container.
  Some of these variables are the same across instances of a single app,
  and some vary from instance to instance.
  
  You can access environment variables programmatically, including variables
  defined by the buildpack.
  For more information, refer to the buildpack documentation for
  [Java](../../buildpacks/java/java-tips.html#env-var),
  [Node.js](../../buildpacks/node/node-tips.html#env-var), and
  [Ruby](../../buildpacks/ruby/ruby-tips.html#env-var).
  
  <table border="1" class="nice">
    <tr>
      <th>Env Var</th>
      <th>Running</th>
      <th>Staging</th>
      <th>Task</th>
    </tr>
    <tr>
      <td><code>CF_INSTANCE_ADDR</code></td>
      <td>x</td>
      <td>x</td>
      <td>x</td>
    </tr>
    <tr>
      <td><code>CF_INSTANCE_GUID</code></td>
      <td>x</td>
      <td></td>
      <td>x</td>
    </tr>
    <tr>
      <td><code>CF_INSTANCE_INDEX</code></td>
      <td>x</td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td><code>CF_INSTANCE_INTERNAL_IP</code></td>
      <td>x</td>
      <td>x</td>
      <td>x</td>
    </tr>
    <tr>
      <td><code>CF_INSTANCE_IP</code></td>
      <td>x</td>
      <td>x</td>
      <td>x</td>
    </tr>
    <tr>
      <td><code>CF_INSTANCE_PORT</code></td>
      <td>x</td>
      <td>x</td>
      <td>x</td>
    </tr>
    <tr>
      <td><code>CF_INSTANCE_PORTS</code></td>
      <td>x</td>
      <td>x</td>
      <td>x</td>
    </tr>
    <tr>
      <td><code>CF_STACK</code></td>
      <td></td>
      <td>x</td>
      <td></td>
    </tr>
    <tr>
      <td><code>DATABASE_URL</code></td>
      <td>x</td>
      <td></td>
      <td>x</td>
    </tr>
    <tr>
      <td><code>HOME</code></td>
      <td>x</td>
      <td>x</td>
      <td>x</td>
    </tr>
    <tr>
      <td><code>INSTANCE_GUID</code></td>
      <td>x</td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td><code>INSTANCE_INDEX</code></td>
      <td>x</td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td><code>LANG</code></td>
      <td>x</td>
      <td>x</td>
      <td>x</td>
    </tr>
    <tr>
      <td><code>MEMORY_LIMIT</code></td>
      <td>x</td>
      <td>x</td>
      <td>x</td>
    </tr>
    <tr>
      <td><code>PATH</code></td>
      <td>x</td>
      <td>x</td>
      <td>x</td>
    </tr>
    <tr>
      <td><code>PORT</code></td>
      <td>x</td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td><code>PWD</code></td>
      <td>x</td>
      <td>x</td>
      <td>x</td>
    </tr>
    <tr>
      <td><code>TMPDIR</code></td>
      <td>x</td>
      <td></td>
      <td>x</td>
    </tr>
    <tr>
      <td><code>USER</code></td>
      <td>x</td>
      <td>x</td>
      <td>x</td>
    </tr>
    <tr>
      <td><code>VCAP_APP_HOST</code></td>
      <td>x</td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td><code>VCAP_APP_PORT</code></td>
      <td>x</td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td><code>VCAP_APPLICATION</code></td>
      <td>x</td>
      <td>x</td>
      <td>x</td>
    </tr>
    <tr>
      <td><code>VCAP_SERVICES</code></td>
      <td>x</td>
      <td>x</td>
      <td>x</td>
    </tr>
  </table>
  
  ### <a id='CF-INSTANCE-ADDR'></a>CF\_INSTANCE\_ADDR ###
  The [CF\_INSTANCE\_IP](#CF-INSTANCE-IP) and
  [CF\_INSTANCE\_PORT](#CF-INSTANCE-PORT) of the app instance in the format
  `IP:PORT`.
  
  Example: `CF_INSTANCE_ADDR=1.2.3.4:5678`
  
  ### <a id='CF-INSTANCE-GUID'></a>CF\_INSTANCE\_GUID ###
  The UUID of the particular instance of the app.
  
  Example: `CF_INSTANCE_GUID=41653aa4-3a3a-486a-4431-ef258b39f042`
  
  ### <a id='CF-INSTANCE-INDEX'></a>CF\_INSTANCE\_INDEX ###
  The index number of the app instance.
  
  Example: `CF_INSTANCE_INDEX=0`
  
  ### <a id='CF-INSTANCE-IP'></a>CF\_INSTANCE\_IP ###
  The external IP address of the host running the app instance.
  
  Example: `CF_INSTANCE_IP=1.2.3.4`
  
  ### <a id='CF-INSTANCE-INTERNAL-IP'></a>CF\_INSTANCE\_INTERNAL_IP ###
  The internal IP address of the container running the app instance.
  
  Example: `CF_INSTANCE_INTERNAL_IP=5.6.7.8`
  
  ### <a id='CF-INSTANCE-PORT'></a>CF\_INSTANCE\_PORT ###
  
  The external, or *host-side*, port corresponding to the internal, or *container-side*, port with value [PORT](#PORT).
  This value is generally different from the
  [PORT](#PORT) of the app instance.
  
  Example: `CF_INSTANCE_PORT=61045`
  
  ### <a id='CF-INSTANCE-PORTS'></a>CF\_INSTANCE\_PORTS ###
  
  The list of mappings between internal, or *container-side*, and external, or *host-side*, ports allocated to the instance's container.
  Not all of the internal ports are necessarily available for the app to
  bind to, as some of them may be used by system-provided services that also run
  inside the container. These internal and external values may differ.
  
  Example: `CF_INSTANCE_PORTS=[{external:61045,internal:8080},{external:61046,internal:2222}]`
  
  ### <a id='DATABASE-URL'></a>DATABASE\_URL ###
  
  For apps bound to certain services that use a database, CF creates a `DATABASE_URL` environment variable based on the [VCAP_SERVICES](#VCAP-SERVICES) environment variable at runtime.
  
  CF uses the structure of the `VCAP_SERVICES` environment variable to populate `DATABASE_URL`.
  CF recognizes any service containing a JSON object with the following form as a candidate for `DATABASE_URL` and uses the first candidate it finds.
  
      {
        "some-service": [
  
negative.code: owner: CAPI
  ---
  
  This page describes the environment variables that the Cloud Foundry (CF) runtime and buildpacks set for a deployed app.
  
  
  ## <a id='overview'></a> Overview
  
  Environment variables are the means by which the CF runtime communicates with a deployed app about its environment.
  
  For information about setting your own app-specific environment variables, see the [Environment Variable](./manifest.html#env-block) section of the _Deploying with App Manifests_ topic.
  
  
  ## <a id='view-env'></a> View Environment Variables
  
  Install the Cloud Foundry Command Line Interface (cf CLI), and use the `cf env` command to view the CF environment variables for your app. The `cf env` command displays the following environment variables:
  
  * The `VCAP_APPLICATION` and `VCAP_SERVICES` variables provided in the container environment
  
  * The user-provided variables set using the `cf set-env` command
  
  For more information about the `cf env` command, see [env](http://cli.cloudfoundry.org/en-US/cf/env.html) in the cf CLI documentation. For more information about the `cf set-env` command, see [set-env](http://cli.cloudfoundry.org/en-US/cf/set-env.html) in the cf CLI documentation.
  
  The following example demonstrates the environment variables `cf env` displays:
  
  <pre class="terminal">
  $ cf env my-app
  