Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "safe-env", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Returns all environment variables with sensitive values hidden, great for logs", | ||
@@ -63,17 +63,17 @@ "author": "Gleb Bahmutov <gleb.bahmutov@gmail.com>", | ||
"devDependencies": { | ||
"check-more-types": "2.21.0", | ||
"check-more-types": "2.22.0", | ||
"condition-node-version": "1.3.0", | ||
"deps-ok": "1.1.0", | ||
"git-issues": "1.2.0", | ||
"lazy-ass": "1.4.0", | ||
"lazy-ass": "1.5.0", | ||
"license-checker": "5.1.2", | ||
"mocha": "2.5.3", | ||
"nsp": "2.4.0", | ||
"pre-git": "3.9.1", | ||
"semantic-release": "^4.3.5", | ||
"standard": "7.1.2", | ||
"standard-format": "2.2.1" | ||
"mocha": "3.0.2", | ||
"nsp": "2.6.1", | ||
"pre-git": "3.10.0", | ||
"semantic-release": "6.3.0", | ||
"standard": "8.0.0-beta.4", | ||
"standard-format": "2.2.2" | ||
}, | ||
"dependencies": { | ||
"ramda": "0.21.0" | ||
"ramda": "0.22.1" | ||
}, | ||
@@ -80,0 +80,0 @@ "release": { |
@@ -15,2 +15,4 @@ # safe-env | ||
## Example | ||
```js | ||
@@ -31,7 +33,16 @@ const safeEnv = require('safe-env') | ||
## Options | ||
You can pass an object to be filtered instead of using `process.env` | ||
```js | ||
const result = safeEnv(sensitive, myObject) | ||
``` | ||
## Details | ||
* Only all uppercase keys from `process.env` are printed, | ||
* Only all uppercase keys from `process.env` are printed, | ||
filtering out lots of noise, like `npm_...` keys. | ||
* There is a [default list](src/private-keys.js) of sensitive keys, if you do not pass any. | ||
* Only top level properties are replaced | ||
@@ -78,5 +89,5 @@ ### Small print | ||
[npm-icon]: https://nodei.co/npm/safe-env.png?downloads=true | ||
[npm-icon]: https://nodei.co/npm/safe-env.svg?downloads=true | ||
[npm-url]: https://npmjs.org/package/safe-env | ||
[ci-image]: https://travis-ci.org/bahmutov/safe-env.png?branch=master | ||
[ci-image]: https://travis-ci.org/bahmutov/safe-env.svg?branch=master | ||
[ci-url]: https://travis-ci.org/bahmutov/safe-env | ||
@@ -83,0 +94,0 @@ [semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg |
'use strict' | ||
const R = require('ramda') | ||
// default private keys | ||
const privateKeys = require('./private-keys') | ||
function upperCaseEnvVariables () { | ||
function upperCaseEnvVariables (object) { | ||
const isKeyAllUpperCase = (val, key) => key.toUpperCase() === key | ||
const userVars = R.pickBy(isKeyAllUpperCase, process.env) | ||
const userVars = R.pickBy(isKeyAllUpperCase, object) | ||
return userVars | ||
@@ -19,5 +20,5 @@ } | ||
function safeEnv (names) { | ||
function safeEnv (names, object) { | ||
names = names || privateKeys | ||
const ups = upperCaseEnvVariables() | ||
const ups = upperCaseEnvVariables(object || process.env) | ||
return hideSomeVariables(ups, names) | ||
@@ -24,0 +25,0 @@ } |
6314
37
95
+ Addedramda@0.22.1(transitive)
- Removedramda@0.21.0(transitive)
Updatedramda@0.22.1