[doc] Document lowerCase option in .env(options) (#268)
- Add missing documentation about the lowerCase option
This commit is contained in:
parent
5e8a34d6cf
commit
552300a687
1 changed files with 15 additions and 1 deletions
16
README.md
16
README.md
|
@ -205,13 +205,27 @@ Responsible for loading the values parsed from `process.env` into the configurat
|
||||||
// Get the value of the env variable 'database__host'
|
// Get the value of the env variable 'database__host'
|
||||||
var dbHost = nconf.get('database:host');
|
var dbHost = nconf.get('database:host');
|
||||||
|
|
||||||
|
//
|
||||||
|
// Can also lowerCase keys.
|
||||||
|
// Especially handy when dealing with environment variables which are usually
|
||||||
|
// uppercased while argv are lowercased.
|
||||||
|
//
|
||||||
|
|
||||||
|
// Given an environment variable PORT=3001
|
||||||
|
nconf.env();
|
||||||
|
var port = nconf.get('port') // undefined
|
||||||
|
|
||||||
|
nconf.env({ lowerCase: true });
|
||||||
|
var port = nconf.get('port') // 3001
|
||||||
|
|
||||||
//
|
//
|
||||||
// Or use all options
|
// Or use all options
|
||||||
//
|
//
|
||||||
nconf.env({
|
nconf.env({
|
||||||
separator: '__',
|
separator: '__',
|
||||||
match: /^whatever_matches_this_will_be_whitelisted/
|
match: /^whatever_matches_this_will_be_whitelisted/
|
||||||
whitelist: ['database__host', 'only', 'load', 'these', 'values', 'if', 'whatever_doesnt_match_but_is_whitelisted_gets_loaded_too']
|
whitelist: ['database__host', 'only', 'load', 'these', 'values', 'if', 'whatever_doesnt_match_but_is_whitelisted_gets_loaded_too'],
|
||||||
|
lowerCase: true
|
||||||
});
|
});
|
||||||
var dbHost = nconf.get('database:host');
|
var dbHost = nconf.get('database:host');
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue