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

Add a configuration method to indicate that a .env file is optional #44

Closed
MrDave1999 opened this issue Feb 27, 2022 · 0 comments · Fixed by #46
Closed

Add a configuration method to indicate that a .env file is optional #44

MrDave1999 opened this issue Feb 27, 2022 · 0 comments · Fixed by #46
Labels
feature New feature or request
Milestone

Comments

@MrDave1999
Copy link
Owner

This feature will indicate that the existence of the .env file is optional, so it can be in some directory or not.

For example:

new EnvLoader()
      .AddEnvFile(".env.example1", Encoding.UTF8, optional: true) // AddEnvFile(string, Encoding, bool)
      .AddEnvFile(".env.example2", encodingName: "UTF-8", optional: true) // AddEnvFile(string, string, bool)
      .AddEnvFile(".env.example3", optional: true)  // AddEnvFile(string, bool)
      .Load();

In the above example, since the three .env files (.env.example1, .env.example2, .env.example3) are optional, the Load method will not generate an error in case the .env file is not found in a directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant