Skip to content

Added 'optional' parameter and handle exception if file cannot be found #81

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

Merged

Conversation

ricardoboss
Copy link

Fixes #79

@ricardoboss ricardoboss changed the title Added 'optional' parameter can handle exception if file cannot be found Added 'optional' parameter and handle exception if file cannot be found Mar 2, 2023
Copy link

@mirland mirland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks for adding it

@@ -61,9 +61,19 @@ class DotEnv {
/// Loads environment variables from the env file into a map
/// Merge with any entries defined in [mergeWith]
Future<void> load(
{String fileName = '.env',Parser parser = const Parser(),Map<String, String> mergeWith = const {}}) async {
{String fileName = '.env',Parser parser = const Parser(),Map<String, String> mergeWith = const {}, bool optional = false}) async {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use multiple lines to clarify the sign

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole file doesn't meet dart format. One simple flutter format lib would fix this, but I didn't want to let this PR get out of scope.

@java-james java-james merged commit f2d3c81 into java-james:master Jun 1, 2023
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.

[feature-request] Add the ability to load an optional env
3 participants