This repository has been archived by the owner. It is now read-only.
NodeJS application that consumes Dingo S3 credentials for Amazon S3 API
JavaScript HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Example nodejs application

This application consumes s3 credentials supplied via the dingo-s3 service broker.

Run the app

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

Accessing credentials

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"