This application consumes s3 credentials supplied via the dingo-s3 service broker.
cf create-service dingo-s3 essential node-s3-example-s3
cf push --no-start
cf bind-service node-s3-example node-s3-example-s3
cf start node-s3-example
Use cf-env to access the credentials via the method require('cfenv').getAppEnv().getServiceCreds(/s3/)
. The method getServiceCreds(spec)
must receive either the exact name or a regular expression matching the name of the service instance.
The returned structure looks like this:
{
"username": "IAM_USER_NAME",
"access_key_id": "AWS_ACCESS_KEY",
"secret_access_key": "AWS_SECRET",
"bucket": "BUCKET_NAME"
}