inxilpro / node-checkenv

Check your current environmental variables against a project config file
46 stars 6 forks source link

Doesn't seem to perform check if *any* of the expected env vars are found #2

Closed timwis closed 8 years ago

timwis commented 8 years ago

Here's my test case:

require('checkenv').check()
console.log('Arrived')
{
  "PROXY_TO": {
    "description": "ArcGIS REST endpoint to pass converted requests to",
    "required": true
  },
  "DEFAULT_PARAMS": {
    "description": "Querystring parameters to pass along by default",
    "required": false
  },
  "DEBUG": {
    "description": "Enable debug mode to log activity to console",
    "required": false
  }
}

Then if I run via:

$ node test-case.js

I get the expected errors:

The following 1 environmental variable is required: 
PROXY_TO ArcGIS REST endpoint to pass converted requests to

The following 2 environmental variables are missing (but optional): 
DEFAULT_PARAMS Querystring parameters to pass along by default
DEBUG Enable debug mode to log activity to console

However, when I run it with one of the environment variables:

$ DEFAULT_PARAMS=x node test-case.js

I get no errors; it just gives me the Arrived console log.

This behavior occurs when I use dotenv with a .env file as well. Am I doing something wrong?

inxilpro commented 8 years ago

Hah, good catch. That was a stupid bug that should have been caught in testing. Fixed now.