Environment Variables Defined by the Ruby Buildpack

Page last updated:

Cloud Foundry provides configuration information to applications through environment variables. This topic describes the additional environment variables provided by the Ruby buildpack.

For more information about the standard environment variables provided by Cloud Foundry, see the Cloud Foundry Environment Variables topic.

Ruby Buildpack Environment Variables

The following table describes the environment variables provided by the Node buildpack.

Environment Variable Description
BUNDLE_BIN_PATH The directory where Bundler installs binaries. Example: BUNDLE_BIN_PATH:/home/vcap/app/vendor/bundle/ruby/1.9.1/gems/bundler-1.3.2/bin/bundle
BUNDLE_GEMFILE The path to the Gemfile for the app. Example: BUNDLE_GEMFILE:/home/vcap/app/Gemfile
BUNDLE_WITHOUT Instructs Cloud Foundry to skip gem installation in excluded groups. Use this with Rails applications, where “assets” and “development” gem groups typically contain gems that are not needed when the app runs in production. Example: BUNDLE_WITHOUT=assets

For more information, see this [blog post](https://blog.pivotal.io/pivotal-cloud-foundry/products/polishing-cloud-foundrys-ruby-gem-support).
DATABASE_URL The Ruby buildpack examines the database_uri for bound services to see if they match known database types. If known relational database services are bound to the application, the buildpack sets the DATABASE_URL environment variable as the first services in the list.

If your application requires that DATABASE_URL is set to the connection string for your service, and Cloud Foundry does not set it, use the Cloud Foundry Command Line Interface (cf CLI) cf set-env command to set this variable manually. Example:
$ cf set-env my_app_name DATABASE_URL mysql://ab:ab@cd.example.com:33/ab_cd
GEM_HOME The directory where gems are installed. Example: GEM_HOME:/home/vcap/app/vendor/bundle/ruby/1.9.1
GEM_PATH The directory where gems can be found. Example: GEM_PATH=/home/vcap/app/vendor/bundle/ruby/1.9.1:
RACK_ENV The Rack deployment environment, which governs the middleware loaded to run the app. Valid value are development, test, and production. Example: RAILS_ENV=production
RUBYOPT Defines command-line options passed to Ruby interpreter. Example: RUBYOPT: -I/home/vcap/app/vendor/bundle/ruby/1.9.1/gems/bundler-1.3.2/lib -rbundler/setup
View the source for this page in GitHub