hughsk / envify

:wrench: Selectively replace Node-style environment variables with plain strings.
902 stars 57 forks source link

undefined values? #11

Closed nmn closed 9 years ago

nmn commented 10 years ago

I've been trying to use envify and it works great for the environment variables I actually put in.

However, any environment variables I fail to put in are left untouched. It would be nice if they were replaces with undefined, as the code very often depends on that behavior.

In particular I'm dealing with something like this

module.exports = {
  hostname: process.env.HOSTNAME || 'http://example.com'
};

right now if the HOSTNAME environment variable is not set this code is left untouched. It would be nice if this was transformed to:

module.exports = {
  hostname: undefined || 'http://example.com'
};

as that is the correct behavior. Thanks.

tjconcept commented 9 years ago

I've had the same issue and have just implemented this. I'll do a pull request once I've written some tests.

tjconcept commented 9 years ago

Guess this can be closed? :)