forked from HuaweiTech/docs-services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
binding-credentials.html.md.erb
89 lines (83 loc) · 3.09 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
---
title: Binding Credentials
---
If your service is bindable, it means that in response to the bind API call, you
will return credentials which can be consumed by an application.
Cloud Foundry writes these credentials to the [environment variable](../devguide/deploy-apps/environment-variable.html) `VCAP_SERVICES`.
In some cases buildpacks will write a subset of these credentials to other
environment variables that frameworks may expect.
Please choose from the following list of credential fields if possible.
You can provide additional fields as needed, but if any of these fields meet
your needs you should use them.
This convention allows developers to provide buildpacks and libraries which
either parse `VCAP_SERVICES` and deliver useful objects to applications, or
which actually configure applications themselves with a service connection.
**Important: If you provide a service which supports a connection string, you
should provide at least the `uri` key; as mentioned you may also provide
discrete credential fields.
Buildpacks and application libraries use the `uri` key.**
| Credentials | Description |
|---------------|-------------|
| uri | Connection string of the form **dbtype://username:password@hostname:port/name**, where **dbtype** is mysql, postgres, mongodb, amqp, etc. |
| hostname | The FQDN of the server host |
| port | The port of the server host |
| name | Name of the service instance; database name |
| vhost | Name of the messaging server virtual host (replacement for **name** specific to AMQP providers) |
| username | Server user |
| password | Server password |
Here is an example output of `ENV['VCAP_SERVICES']`.
Note that ClearDB chooses to return both discrete credentials, a uri, as well as
another field.
CloudAMQP chooses to return just the uri, and RedisCloud returns only discrete
credentials.
<pre class="highlight xml">
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:ebfc00ac@us-cdbr-east-03.cleardb.com:3306/ad_c6f4446532610ab",
jdbcUrl: "jdbc:mysql://b5d435f40dd2b2:ebfc00ac@us-cdbr-east-03.cleardb.com:3306/ad_c6f4446532610ab"
}
}
],
cloudamqp: [
{
name: "cloudamqp-6",
label: "cloudamqp",
plan: "lemur",
credentials: {
uri: "amqp://ksvyjmiv:IwN6dCdZmeQD4O0ZPKpu1YOaLx1he8wo@lemur.cloudamqp.com/ksvyjmiv"
}
}
{
name: "cloudamqp-9dbc6",
label: "cloudamqp",
plan: "lemur",
credentials: {
uri: "amqp://vhuklnxa:9lNFxpTuJsAdTts98vQIdKHW3MojyMyV@lemur.cloudamqp.com/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>