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

includeProcessEnv is not added to .env to map .env.schema #44

Closed
jlanza opened this issue Sep 8, 2020 · 1 comment
Closed

includeProcessEnv is not added to .env to map .env.schema #44

jlanza opened this issue Sep 8, 2020 · 1 comment

Comments

@jlanza
Copy link

jlanza commented Sep 8, 2020

I was going to write about this issue as a bug in the library that is closely related with the answer to issue #35.

$ cat .env.schema
VAR1=
VAR2=
$ cat .env
VAR1=hi
$ VAR2=myname node app.js
Error: MISSING CONFIG VALUES: VAR2

In my code I have:

import dotEnvExtended from 'dotenv-extended';
dotEnvExtended.load({includeProcessEnv: true, errorOnMissing: true, errorOnExtra: false});

Reading the documentation there shouldn't be an error as the ìncludeProcessEnv put together variables from process.env, .env and .env.defaults. So in this case the addition is the same as the .env.schema requirement.

The only way I managed to avoid the error is by copying .env.schema to .env.defaults.

It think this is a bug of the library that should be fixed as the schema should be validated against the addition of process.env and the files.

@jlanza
Copy link
Author

jlanza commented Sep 8, 2020

Please remove the issue as it may mislead other developers. It's being my fault. I didn't notice that I have two places in the code retrieving the configuration and in one of them I haven't include the includeProcessEnv: true

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

No branches or pull requests

2 participants