envboss
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "envboss", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "package for environment variables", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -17,8 +17,10 @@ [![Known Vulnerabilities](https://snyk.io/test/github/PayU/envboss/badge.svg?targetFile=package.json)](https://snyk.io/test/github/PayU/envboss?targetFile=package.json) | ||
## How does it work? | ||
It takes each <ENV_PARAM_NAME> from `process.env` and creates an environmentVariables object with `process.env[<ENV_PARAM_NAME>]` | ||
as it's value, so you can require it from anywhere. | ||
It goes over the configuration you provide, and returns an object where the `key` is the `<ENV_PARAM_NAME>` and the value is `process.env[<ENV_PARAM_NAME>]` after it was validated and sanitized. | ||
### configuration | ||
If you wouldn't like to validate envparams(e.g. in tests) pass pass false to | ||
```createEnvObject(ENV_VARS_CONFIG,false)``` | ||
`mandatory` - sets this param as mandatory. | ||
`default` - lets you define a default value. | ||
`validationFunction` - will help you validate the values. | ||
@@ -31,2 +33,6 @@ | ||
If you wouldn't like to validate envparams(e.g. in tests) pass pass false to | ||
```createEnvObject(ENV_VARS_CONFIG,false)``` | ||
@@ -33,0 +39,0 @@ ***Installation*** |
18190
69