Service binding of applications
Whenever a service is bound to an application (or to multiple applications), the key step it performs is to inject the service's configuration and credentials into an application. This information can be found in an application's environment variables, within VCAP_SERVICES
. The VCAP_SERVICES
is a JSON object that contains an array of information pertaining to bound services for that application. This is on the contrary to its sister JSON object, VCAP_APPLICATION
, that holds information pertaining to the configuration of the application itself, such as its URL, memory limits, and disk capacity. We can view an application's environment variable through the cf env <APP_NAME>
command.
If we clone a fresh copy of the hello-spring-cloud
application from https://github.com/Cloud-Foundry-For-Developers/hello-spring-cloud.git and deploy it onto Cloud Foundry, we can perform a cf env hello-spring-cloud
:
Figure 1: Getting the environment variables of a fresh copy...