-
Notifications
You must be signed in to change notification settings - Fork 60
/
binding-credentials.html.md.erb
125 lines (118 loc) · 3.6 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
---
title: Binding credentials
owner: Core Services
---
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
<% if vars.guide_name == 'Tile Developer' %>
[`VCAP_SERVICES`](https://docs.vmware.com/en/VMware-Tanzu-Application-Service/<%= vars.current_major_version %>/tas-for-vms/deploy-apps-environment-variable.html) environment variable.
<% else %>
[`VCAP_SERVICES`](../devguide/deploy-apps/environment-variable.html#VCAP-SERVICES) environment variable.
<% end %>
In some cases, buildpacks can write a subset of these credentials to other
environment variables that frameworks might need.
Choose from the following list of credential fields, if possible, although you can provide additional fields as
needed.
Refer to the
<% if vars.guide_name == 'Tile Developer' %>
[Using Bound Services](https://docs.vmware.com/en/VMware-Tanzu-Application-Service/<%= vars.current_major_version %>/tas-for-vms/services-managing-services.html)
<% else %>
[Using Bound Services](../devguide/services/managing-services.html#use)
<% end %>
section of the _Managing Service Instances with the CLI_ topic for information about how these
credentials are consumed.
If you provide a service that supports a connection string, provide the <code>uri</code> key for
buildpacks and application libraries to use.
<table>
<thead>
<tr>
<th><strong>Credentials</strong></th>
<th><strong>Description</strong></th>
</tr>
</thead>
<tbody>
<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>
</tbody>
</table>
The following is an example output of `ENV['VCAP_SERVICES']`.
Depending on the types of databases you are using, each database might return different
credentials.
```
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"
}
},
],
}
```