Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not override set vars with falsy values #203

Merged
merged 1 commit into from
Jun 20, 2017
Merged

Do not override set vars with falsy values #203

merged 1 commit into from
Jun 20, 2017

Conversation

marcoow
Copy link
Contributor

@marcoow marcoow commented Jun 8, 2017

Currently dotenv would override env vars that are set but are set to a falsy value, e.g. '':

cat .env
MYVAR=value

MYVAR='' node
> process.env.MYVAR
''
> const dotenv = require('dotenv');
> dotenv.config()
{ MYVAR: 'value' }

This changes that behavior so that any env var that is present in process.env will be kept, regardless of its value:

cat .env
MYVAR=value

MYVAR='' node
> process.env.MYVAR
''
> const dotenv = require('dotenv');
> dotenv.config()
{ MYVAR: '' }

I think this would have to be considered a breaking change and would require a major version update.

Closes #202

@coveralls
Copy link

coveralls commented Jun 8, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling b61c605 on simplabs:fix-override into 825c1b2 on motdotla:master.

Copy link
Collaborator

@jcblw jcblw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR

@maxbeatty maxbeatty merged commit 25bf5ad into motdotla:master Jun 20, 2017
@Turbo87 Turbo87 deleted the fix-override branch June 28, 2017 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants