README.md in dotenv-rails-2.2.2 vs README.md in dotenv-rails-2.3.0

- old
+ new

@@ -1,9 +1,7 @@ -# dotenv [![Build Status](https://secure.travis-ci.org/bkeepers/dotenv.png?branch=master)](https://travis-ci.org/bkeepers/dotenv) +# dotenv [![Build Status](https://secure.travis-ci.org/bkeepers/dotenv.png?branch=master)](https://travis-ci.org/bkeepers/dotenv) [![Gem Version](https://badge.fury.io/rb/dotenv.svg)](https://badge.fury.io/rb/dotenv) [![Join the chat at https://gitter.im/bkeepers/dotenv](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bkeepers/dotenv?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Join the chat at https://gitter.im/bkeepers/dotenv](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bkeepers/dotenv?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - Shim to load environment variables from `.env` into `ENV` in *development*. Storing [configuration in the environment](http://12factor.net/config) is one of the tenets of a [twelve-factor app](http://12factor.net). Anything that is likely to change between deployment environments–such as resource handles for databases or credentials for external services–should be extracted from the code into environment variables. But it is not always practical to set environment variables on development machines or continuous integration servers where multiple projects are run. dotenv loads variables from a `.env` file into `ENV` when the environment is bootstrapped. @@ -73,10 +71,16 @@ ```shell $ dotenv ./script.rb ``` +The `dotenv` executable also accepts a single flag, `-f`. Its value should be a comma-separated list of configuration files, in the order of most important to least. All of the files must exist. There _must_ be a space between the flag and its value. + +``` +$ dotenv -f ".env.local,.env" ./script.rb +``` + To ensure `.env` is loaded in rake, load the tasks: ```ruby require 'dotenv/tasks' @@ -110,11 +114,23 @@ ### Multi-line values If you need multiline variables, for example private keys, you can double quote strings and use the `\n` character for newlines: ```shell -PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nHkVN9…\n-----END DSA PRIVATE KEY-----\n" +PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nHkVN9...\n-----END DSA PRIVATE KEY-----\n" ``` + +Alternatively, multi-line values with line breaks are now supported for quoted values. + +```shell +PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY----- +... +HkVN9... +... +-----END DSA PRIVATE KEY-----" +``` + +This is particularly helpful when using the Heroku command line plugin [`heroku-config`](https://github.com/xavdid/heroku-config) to pull configuration variables down that may have line breaks. ### Command Substitution You need to add the output of a command in one of your variables? Simply add it with `$(your_command)`: