Skip to content

Add note about comments in .env files #3403

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

Closed
wants to merge 1 commit into from
Closed

Conversation

dflock
Copy link

@dflock dflock commented Feb 2, 2019

You can put "comments" in .env files, because lines that don't start with letters or numbers are ignored - see here for the code that reads these files.

I'm not sure if this constitutes "official" support for comments in .env files or not - or if it's just taking advantage of an implementation detail.

Either way, I wanted to put comments into this file, so this was useful information to me - and something that I had to figure out myself.

This commit adds a note about this to the docs, using the # to denote a comment line - although any non-alphanumeric char would work.

You can put "comments" in .env files, because lines that don't start with letters or numbers are ignored - see [here](https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/util/loadEnv.js#L17) for the code that reads these files.

I'm not sure if this constitutes "official" support for comments in .env files or not - or if it's just taking advantage of an implementation detail.

Either way, I wanted to put comments into this file, so this was useful information to me - and something that I had to figure out myself.

This commit adds a note about this to the docs, using the `#` to denote a comment line - although any non-alphanumeric char would work.
@haoqunjiang
Copy link
Member

Thanks for your insight. After looking into this issue deeper, I found much of our .env parsing logic were copied from dotenv. So I decided to refactor that part of code to use dotenv directly and link the documentation to its README #3462, considering that their documentation is more comprehensive.

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.

2 participants