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

Remove comments while parsing/Support inline comments #484

Closed
JaneJeon opened this issue Aug 5, 2020 · 3 comments · Fixed by #568
Closed

Remove comments while parsing/Support inline comments #484

JaneJeon opened this issue Aug 5, 2020 · 3 comments · Fixed by #568

Comments

@JaneJeon
Copy link

JaneJeon commented Aug 5, 2020

In VSCode, when you install the dotenv extension, it greys out sections following a hashtag, e.g.:

SOME_VAR=HELLO # explanation of SOME_VAR, or why it's assigned the value HELLO
               ^--------------------this part is greyed out------------------^

However, dotenv the package does not respect that. In fact, I often got burned by the fact that dotenv just straight up includes the comments in the actual value for the environment variable, which is super unintuitive.

I'd love it if I could have inline comments without fear of screwing up the environment variables.

Love the work you're doing,
thanks!

@fastfedora
Copy link

I'll like to second this request. I just got bit by this expectation as well.

Issue #156 addressed this, but was closed saying that dotenv is expected to be just like a .ini file. Except that it's in the format of Unix shell variables, and most shells support inline comments in their configuration files. So the expectation is that this is supported.

Nor is the issue immediately obvious, since dotenv does not throw an error, but merely includes the comment as part of the variable value, so it can take a while to track down the issue as a .env file issue.

berekuk added a commit to berekuk/next.js that referenced this issue Dec 1, 2020
dotenv currently doesn't support inline comments (see motdotla/dotenv#484), so it's misleading to use inline comments in documentation examples.
kodiakhq bot pushed a commit to vercel/next.js that referenced this issue Dec 1, 2020
dotenv currently doesn't support inline comments (see motdotla/dotenv#484), so it's misleading to use inline comments in documentation examples.
@dotnetCarpenter
Copy link

I got the same issue. After searching for comment syntax, I found https://github.com/vlucas/phpdotenv#comments which is a PHP implementation that allows comments after the key-value. I think it is important to keep parity between .env implementations so that the same .env file can be used across different implementations. E.i. Ruby dotenv, PHP dotenv and Nodejs Dotenv.

Original Ruby Dotenv comment syntax: https://github.com/bkeepers/dotenv#comments

PiDelport added a commit to registreerocks/registree-core that referenced this issue Jan 25, 2021
dotenv does not actually support inline comments, so these comments were
being parsed incorrectly as part of the environment variable values.

Upstream issue: motdotla/dotenv#484

This also groups and sorts the environment variables for readability,
and removes the quotes around values.

(Quotes should probably only be used around values with significant
spaces, to avoid confusion.)
PiDelport added a commit to registreerocks/registree-core that referenced this issue Jan 26, 2021
…d format

dotenv does not actually support inline comments, so these comments were
being parsed incorrectly as part of the environment variable values.

Upstream issue: motdotla/dotenv#484

This also groups and sorts the environment variables for readability,
and removes the quotes around values.

(Quotes should probably only be used around values with significant
spaces, to avoid confusion.)
PiDelport added a commit to registreerocks/registree-core that referenced this issue Jan 26, 2021
…d format

dotenv does not actually support inline comments, so these comments were
being parsed incorrectly as part of the environment variable values.

Upstream issue: motdotla/dotenv#484

This also groups and sorts the environment variables for readability,
and removes the quotes around values.

(Quotes should probably only be used around values with significant
spaces, to avoid confusion.)
PiDelport added a commit to registreerocks/registree-core that referenced this issue Feb 3, 2021
…d format

dotenv does not actually support inline comments, so these comments were
being parsed incorrectly as part of the environment variable values.

Upstream issue: motdotla/dotenv#484

This also groups and sorts the environment variables for readability,
and removes the quotes around values.

(Quotes should probably only be used around values with significant
spaces, to avoid confusion.)
PiDelport added a commit to registreerocks/registree-core that referenced this issue Feb 8, 2021
…d format

dotenv does not actually support inline comments, so these comments were
being parsed incorrectly as part of the environment variable values.

Upstream issue: motdotla/dotenv#484

This also groups and sorts the environment variables for readability,
and removes the quotes around values.

(Quotes should probably only be used around values with significant
spaces, to avoid confusion.)
PiDelport added a commit to registreerocks/registree-core that referenced this issue Feb 8, 2021
…d format

dotenv does not actually support inline comments, so these comments were
being parsed incorrectly as part of the environment variable values.

Upstream issue: motdotla/dotenv#484

This also groups and sorts the environment variables for readability,
and removes the quotes around values.

(Quotes should probably only be used around values with significant
spaces, to avoid confusion.)
PiDelport added a commit to registreerocks/registree-core that referenced this issue Feb 15, 2021
…d format

dotenv does not actually support inline comments, so these comments were
being parsed incorrectly as part of the environment variable values.

Upstream issue: motdotla/dotenv#484

This also groups and sorts the environment variables for readability,
and removes the quotes around values.

(Quotes should probably only be used around values with significant
spaces, to avoid confusion.)
PiDelport added a commit to registreerocks/registree-core that referenced this issue Mar 3, 2021
…d format

dotenv does not actually support inline comments, so these comments were
being parsed incorrectly as part of the environment variable values.

Upstream issue: motdotla/dotenv#484

This also groups and sorts the environment variables for readability,
and removes the quotes around values.

(Quotes should probably only be used around values with significant
spaces, to avoid confusion.)
PiDelport added a commit to registreerocks/registree-core that referenced this issue Mar 17, 2021
…d format

dotenv does not actually support inline comments, so these comments were
being parsed incorrectly as part of the environment variable values.

Upstream issue: motdotla/dotenv#484

This also groups and sorts the environment variables for readability,
and removes the quotes around values.

(Quotes should probably only be used around values with significant
spaces, to avoid confusion.)
PiDelport added a commit to registreerocks/registree-core that referenced this issue Apr 6, 2021
…d format

dotenv does not actually support inline comments, so these comments were
being parsed incorrectly as part of the environment variable values.

Upstream issue: motdotla/dotenv#484

This also groups and sorts the environment variables for readability,
and removes the quotes around values.

(Quotes should probably only be used around values with significant
spaces, to avoid confusion.)
@motdotla
Copy link
Owner

motdotla commented May 5, 2021

I agree that dotenv should support comments. It follows the principle of least surprise and makes for a nice developer experience. I am closing this issue and instead tracking here: #524

@motdotla motdotla closed this as completed May 5, 2021
PiDelport added a commit to registreerocks/registree-core that referenced this issue Jun 1, 2021
…d format

dotenv does not actually support inline comments, so these comments were
being parsed incorrectly as part of the environment variable values.

Upstream issue: motdotla/dotenv#484

This also groups and sorts the environment variables for readability,
and removes the quotes around values.

(Quotes should probably only be used around values with significant
spaces, to avoid confusion.)
PiDelport added a commit to registreerocks/registree-core that referenced this issue Jul 16, 2021
…d format

dotenv does not actually support inline comments, so these comments were
being parsed incorrectly as part of the environment variable values.

Upstream issue: motdotla/dotenv#484

This also groups and sorts the environment variables for readability,
and removes the quotes around values.

(Quotes should probably only be used around values with significant
spaces, to avoid confusion.)
PiDelport added a commit to registreerocks/registree-core that referenced this issue Sep 17, 2021
…d format

dotenv does not actually support inline comments, so these comments were
being parsed incorrectly as part of the environment variable values.

Upstream issue: motdotla/dotenv#484

This also groups and sorts the environment variables for readability,
and removes the quotes around values.

(Quotes should probably only be used around values with significant
spaces, to avoid confusion.)
PiDelport added a commit to registreerocks/registree-core that referenced this issue Oct 18, 2021
…d format

dotenv does not actually support inline comments, so these comments were
being parsed incorrectly as part of the environment variable values.

Upstream issue: motdotla/dotenv#484

This also groups and sorts the environment variables for readability,
and removes the quotes around values.

(Quotes should probably only be used around values with significant
spaces, to avoid confusion.)
PiDelport added a commit to registreerocks/registree-core that referenced this issue Oct 18, 2021
…d format

dotenv does not actually support inline comments, so these comments were
being parsed incorrectly as part of the environment variable values.

Upstream issue: motdotla/dotenv#484

This also groups and sorts the environment variables for readability,
and removes the quotes around values.

(Quotes should probably only be used around values with significant
spaces, to avoid confusion.)
PiDelport added a commit to registreerocks/registree-core that referenced this issue Oct 18, 2021
…d format

dotenv does not actually support inline comments, so these comments were
being parsed incorrectly as part of the environment variable values.

Upstream issue: motdotla/dotenv#484

This also groups and sorts the environment variables for readability,
and removes the quotes around values.

(Quotes should probably only be used around values with significant
spaces, to avoid confusion.)
PiDelport added a commit to registreerocks/registree-core that referenced this issue Oct 19, 2021
…d format

dotenv does not actually support inline comments, so these comments were
being parsed incorrectly as part of the environment variable values.

Upstream issue: motdotla/dotenv#484

This also groups and sorts the environment variables for readability,
and removes the quotes around values.

(Quotes should probably only be used around values with significant
spaces, to avoid confusion.)
PiDelport added a commit to registreerocks/registree-core that referenced this issue Oct 25, 2021
* chore(deps): add mocked-env

yarn add --dev mocked-env

* chore(deps): add dotenv (for tests)

yarn add --dev dotenv

* test(common): add helpers: withMockedEnv, hasAllKeys

* test(config): add initial tests for config accessors

These are mainly to capture the current behaviour, before making any
major changes.

* refactor(config): ensure AppConfig.port is a number

* style(config): avoid redundant ternary

* fix(config): make S3 details optional when LOCAL_OBJECT_STORAGE=true

* fix(config): remove unsupported inline comments from .env.example, and format

dotenv does not actually support inline comments, so these comments were
being parsed incorrectly as part of the environment variable values.

Upstream issue: motdotla/dotenv#484

This also groups and sorts the environment variables for readability,
and removes the quotes around values.

(Quotes should probably only be used around values with significant
spaces, to avoid confusion.)

* fix(config): add a reasonable default AUTH0_DOMAIN to .env.example

This makes it usable as a validated base config.

* feat(upload): make UploadOptions type discriminated on useLocal

This allows preserving the result of useLocal checks in the type system.

* feat(config): use UploadOptions type

* chore: include app-config in coverage again

Previously excluded by:

* #320
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.

4 participants