Skip to content
This repository has been archived by the owner on Nov 13, 2019. It is now read-only.

Commit

Permalink
Add a note about boolean casting
Browse files Browse the repository at this point in the history
  • Loading branch information
chilts committed Jul 18, 2016
1 parent a2b0f7f commit 9b9e6af
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,23 @@ Should output something like:
port: 8080,
debug: false,
env: 'development'
}
}
```

It is advisable to prefix your environment variables with a prefix related to your application
name as shown in the later config vars above. Mainly this is to namespace your vars and not stomp
over others already defined. Of course you don't need to use the prefix in the local name.

## Valid Values ##

When you have certain types, some transformations are performed to get it from a string (since the
environment only contains string) into the required value.

* `boolean` - upper or lower case is allowed
* true - 'true', 't', 'yes', 'y', 'on', '1'
* false - 'false', 'f', 'no', 'n', 'off', '0'
* any other value throws

## What I Do ##

I usually have a `lib/cfg.js` such as the following:
Expand Down

0 comments on commit 9b9e6af

Please sign in to comment.