项目作者: cloudfoundry-community

项目描述 :
Turn VCAP_SERVICES into flat env vars
高级语言: Go
项目地址: git://github.com/cloudfoundry-community/vcap-squash.git
创建时间: 2016-05-13T23:19:29Z
项目社区:https://github.com/cloudfoundry-community/vcap-squash

开源协议:MIT License

下载


vcap-squash Build Status

Turn VCAP_SERVICES into flat env vars

Download

Visit the releases page
and download the binary for your system

Usage

This application will parse the VCAP_SERVICES environment variable and output the unix exports of the flattened version.

Flattened vcap environment variables start with the service name and append _ for each nested credential.
For example:

  1. $ VCAP_SERVICES='{ "user-provided": [ {
  2. "name": "myservice",
  3. "credentials": {
  4. "url": "myservice.com",
  5. "username": "josh",
  6. "password": "secret",
  7. "nested": {
  8. "key": "value",
  9. "number": 123
  10. }
  11. }
  12. } ] }' ./vcap-squash
  13. export MYSERVICE_URL="myservice.com"
  14. export MYSERVICE_USERNAME="josh"
  15. export MYSERVICE_PASSWORD="secret"
  16. export MYSERVICE_NESTED_KEY="value"
  17. export MYSERVICE_NESTED_NUMBER=123

To set your environment variables using this output, use

  1. eval "$(./vcap-squash)"

In Cloud Foundry

Add the proper vcap-squash binary to your project root (depending on cf stack)

Create a .profile.d/setenv.sh file to push along with your repo

  1. #!/bin/sh
  2. eval $(./vcap-squash)

Development

To run all basic tasks, use

  1. $ make

Dependencies

To download needed libraries:

  1. $ make deps

Test

To run the test suite, use

  1. $ make test

Run the test suite in development/watch mode:

  1. $ make watch

Build local

To build a binary using your go env:

  1. $ make build-local

Build all

Build the binary for all systems:

  1. $ make build

the binaries will be placed in ./out