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

Support line breaks and comments in .env file #339

Merged
merged 1 commit into from
Oct 19, 2021
Merged

Support line breaks and comments in .env file #339

merged 1 commit into from
Oct 19, 2021

Conversation

pratyushmittal
Copy link
Contributor

Commit #283 added useful warnings for skipped lines.
However, it also started showing warnings for comments.

Like in .zshrc, we add comments using hash (#). We also group common
blocks together.

Our env files look something like:

SECRET_KEY="S0M3#SecreT"
DATABASE_URL=mysql://py-user:p@@sWord@127.0.0.1:3306/db_name

# Other services (not must to change)
## Google social login
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""

I am not sure if the project intends to support comments.
Will request you please support them if possible :)

The https://github.com/joke2k/django-environ/pull/283/files commit added
useful warnings for skipped lines. However, it also started showing
warnings for comment lines.

Like in `.zshrc`, we add comments using hash (#). We also group common
blocks together.

Our env file was something like:
```env
SECRET_KEY="S0M3#SecreT"
DATABASE_URL=mysql://py-user:p@@sword@127.0.0.1:3306/db_name

GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""
```
@hvdklauw
Copy link

Seconded, comments are great, our environment configs are totally separate from the code, so it's useful to have comments to explain expected values.

@heavenshell
Copy link

As document(A good .env.dist could look like this:) shows comment and blank line.
So, it would be great this PR would be merged 😄

@mike667
Copy link

mike667 commented Oct 18, 2021

Today we updated to 0.8.0 and faced the same problem. Please add support for comments and blank lines. Thanks. Have a nice day.

@sergeyklay sergeyklay linked an issue Oct 19, 2021 that may be closed by this pull request
@sergeyklay
Copy link
Collaborator

@mike667 I'm so sorry! It was my mistake, I did not carefully review the proposed feature.

@sergeyklay sergeyklay self-requested a review October 19, 2021 17:11
@sergeyklay sergeyklay self-assigned this Oct 19, 2021
@sergeyklay sergeyklay added the bug Something isn't working label Oct 19, 2021
@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 91.154% when pulling 96b5804 on pratyushmittal:main into d3f4b01 on joke2k:main.

@mike667
Copy link

mike667 commented Oct 19, 2021

@sergeyklay @pratyushmittal Thank you.

@sergeyklay sergeyklay changed the base branch from main to develop October 19, 2021 20:34
@sergeyklay sergeyklay merged commit 8a2adfa into joke2k:develop Oct 19, 2021
@sergeyklay
Copy link
Collaborator

Thank you for the patch!

@sergeyklay sergeyklay added the hacktoberfest-accepted See https://hacktoberfest.digitalocean.com/ for participants details label Oct 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hacktoberfest-accepted See https://hacktoberfest.digitalocean.com/ for participants details
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Version 0.8.0 generates "Invalid line" error on blank lines in file
6 participants