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

Update index.js #60

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

agodinhost
Copy link

Hi Keith.
I did a minor enhancement in the schema and defaults paths - now it will follow the path of the main env file.

For example:

  const DotenvExtended = new (require('dotenv-extended')) ({
    path: '../mfes-registry/.env' });

is the same as:

  const DotenvExtended = new (require('dotenv-extended')) ({
    path: '../mfes-registry/.env',
    defaults: '../mfes-registry/.env.defaults',
    schema: '../mfes-registry/.env.schema'
  });

I believe that most of the time the main env file will be stored into the same folder as the schema and defaults. It will help to reduce repetitive code.

thanks

@keithmorris
Copy link
Owner

Hi @agodinhost . Thank you for the PR. I do like the direction of this PR. However, this does present a potential issue with the documentation. The docs state that the default values for defaults option is .env.defaults and schema is .env.schema. With your change, it does not make clear that the prefix for the defaults and schema will be whatever is in the path option.

For example, someone could have .env-prod as the path option but could have .env.schema as the schema file. Without an update to the docs, they might assume that since the docs say the default is .env.schema then it would pick that up.

You could either update the docs to indicate that defaults and schema are path + '.defaults' and path + '.schema' or ES6 style `${path}.defaults` and `${path}.schema\`

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