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

Empty ENV is removed instead set as empty string in version 2.3 #339

Closed
radeno opened this issue Apr 23, 2018 · 5 comments · Fixed by #340
Closed

Empty ENV is removed instead set as empty string in version 2.3 #339

radeno opened this issue Apr 23, 2018 · 5 comments · Fixed by #340

Comments

@radeno
Copy link

radeno commented Apr 23, 2018

Steps to reproduce

In file .env.development i have these variables:

DATABASE_PASSWORD=
DATABASE_USERNAME=root
DATABASE_HOST=/tmp/mysql.sock

Expected behavior

Variables should be parsed as:

 "DATABASE_PASSWORD"=>"",
 "DATABASE_USERNAME"=>"root"
 "DATABASE_HOST"="/tmp/mysql.sock"

Actual behavior

In 2.3 missing whole keys DATABASE_PASSWORD and also DATABASE_USERNAME because it is next after empty env variable.

Everything OK in 2.2

System configuration

dotenv version: 2.3

Rails version: 5.2

Ruby version: 2.5

@radeno
Copy link
Author

radeno commented Apr 23, 2018

Problem is in multiline parser

When i define env vars with new line between them:

DATABASE_PASSWORD=

DATABASE_USERNAME=root

DATABASE_HOST=/tmp/mysql.sock

it is parsed as:

 "DATABASE_HOST"=>"/tmp/mysql.sock",
 "DATABASE_PASSWORD"=>"DATABASE_USERNAME=root"

@jonmagic
Copy link
Collaborator

Thank you for the bug report. Looking into potential solutions now.

@jonmagic
Copy link
Collaborator

We just shipped version 2.4.0 which removes the Parse multiline values support added in 2.3.0 and fixes the parsing regressions.

@wbotelhos
Copy link

@radeno @jonmagic To fix that, I just set an empty value, but it should represent a major release:

DATABASE_PASSWORD=''

@radeno
Copy link
Author

radeno commented Apr 25, 2018

@wbotelhos Yes we can pass empy string. But define variable without value is valid. No value as just empty string quotes is very rare.

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 a pull request may close this issue.

3 participants