forked from cloudfoundry/docs-services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbinding-credentials.html.md.erb
111 lines (103 loc) · 3.23 KB
/
binding-credentials.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
---
title: Binding Credentials
owner: Core Services
---
<strong><%= modified_date %></strong>
A bindable service returns credentials that an application can consume in response to the `cf bind` API call.
Cloud Foundry writes these credentials to the [`VCAP_SERVICES`](../devguide/deploy-apps/environment-variable.html#VCAP-SERVICES) environment variable.
In some cases, buildpacks write a subset of these credentials to other
environment variables that frameworks might need.
Choose from the following list of credential fields if possible, though you can provide additional fields as needed.
Refer to the [Using Bound Services](../devguide/services/managing-services.html#use) section of the
_Managing Service Instances with the CLI_ topic for information on how these
credentials are consumed.
<p class='note'><strong>Note</strong>: If you provide a service that supports a connection string, provide the <code>uri</code> key for buildpacks and
application libraries to use.</p>
<table border="1" class="nice">
<tr>
<th><strong>CREDENTIALS</strong></th>
<th><strong>DESCRIPTION</strong></th>
</tr>
<tr>
<td>uri</td>
<td>Connection string of the form <code>DB-TYPE://USERNAME:PASSWORD@HOSTNAME:PORT/NAME</code>,
where <code>DB-TYPE</code> is a type of database such as mysql, postgres, mongodb, or amqp.</td>
</tr>
<tr>
<td>hostname</td>
<td>FQDN of the server host</td>
</tr>
<tr>
<td>port</td>
<td>Port of the server host</td>
</tr>
<tr>
<td>name</td>
<td>Name of the service instance</td>
</tr>
<tr>
<td>vhost</td>
<td>Name of the messaging server virtual host - a replacement for a <code>name</code> specific to AMQP providers</td>
</tr>
<tr>
<td>username</td>
<td>Server user</td>
</tr>
<tr>
<td>password</td>
<td>Server password</td>
</tr>
</table>
The following is an example output of `ENV['VCAP_SERVICES']`.
<p class='note'><strong>Note</strong>: Depending on the types of databases you are using, each database might return different credentials.</p>
<pre>
VCAP_SERVICES=
{
cleardb: [
{
name: "cleardb-1",
label: "cleardb",
plan: "spark",
credentials: {
name: "ad_c6f4446532610ab",
hostname: "us-cdbr-east-03.cleardb.com",
port: "3306",
username: "b5d435f40dd2b2",
password: "ebfc00ac",
uri: "mysql://b5d435f40dd2b2:[email protected]:3306/ad_c6f4446532610ab",
jdbcUrl: "jdbc:mysql://b5d435f40dd2b2:[email protected]:3306/ad_c6f4446532610ab"
}
}
],
cloudamqp: [
{
name: "cloudamqp-6",
label: "cloudamqp",
plan: "lemur",
credentials: {
uri: "amqp://ksvyjmiv:[email protected]/ksvyjmiv"
}
}
{
name: "cloudamqp-9dbc6",
label: "cloudamqp",
plan: "lemur",
credentials: {
uri: "amqp://vhuklnxa:[email protected]/vhuklnxa"
}
}
],
rediscloud: [
{
name: "rediscloud-1",
label: "rediscloud",
plan: "20mb",
credentials: {
port: "6379",
host: "pub-redis-6379.us-east-1-2.3.ec2.redislabs.com",
password: "1M5zd3QfWi9nUyya"
}
},
],
}
</pre>