diff --git a/README.md b/README.md index f1133ef..0991b23 100644 --- a/README.md +++ b/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' 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 // nconf.env({ separator: '__', 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'); ```