Binding a service to an application

Now that we have a service, let's create an application that uses it. As a starting point, we'll use the application we created in Chapter 2, Using the Command-line Tool, which displays environment variables. Now, perform the following steps:

  1. Go to the control panel page for the previous application.
  2. Click on the Clone button on the left side. The Clone Your App display appears.
  3. Choose an infrastructure. This must be the same infrastructure you chose for the database service.
  4. Enter an application name under Enter a domain. For this example, I will use insideaf2 as the application name.
    Binding a service to an application
  5. Click on the Clone App button. The control panel for the old application is replaced by a status display for the cloning process. Once the new application is up and running, its control panel appears.
  6. Click on the Services button on the left side of the page. The services display appears. Notice that the Bound Service list is empty but that the Other Services list contains the database service you created.
    Binding a service to an application
  7. Click on the Bind button for the database service. There is a delay while your application is restarted. Once the process is complete, the database service appears in the Bound Service list.
  8. Click on the View Live Site button at the top of the display. Notice that the application's environment variable list now includes VCAP_SERVICES. We'll use the contents of this variable to access the service from the application. Refer the following screenshot:
    Binding a service to an application
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.106.237