Skip to content

BREAKING(dotenv): remove examplePath option from load[Sync]() #5450

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
merged 2 commits into from
Jul 19, 2024

Conversation

iuioiua
Copy link
Contributor

@iuioiua iuioiua commented Jul 16, 2024

What's changed

The examplePath option for load[Sync]() from @std/dotenv has been removed. The allowEmptyValues option and MissingEnvVarsError have also been removed, as the basis for their existence was dependent on the examplePath option.

Motivation

See details in #5449.

Migration guide

To migrate, if environment variables need to be validated, do so in-code instead of using the examplePath option.

# .env.example
# Notice: missing `QUX` environment variable
FOO=bar
import "@std/dotenv/load";

+ if (!Deno.env.has("QUX") {
+   // ...
+ }

Related

Closes #5449

@iuioiua iuioiua requested a review from kt3k as a code owner July 16, 2024 08:20
Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

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

.env.example is a common file name for showing the examples of what should be in .env file. https://github.com/search?q=path%3A.env.example&type=code

However using that file as the validator of .env file feels like an opinionated interpretation of it, and doesn't seem fitting to the policy of std. This removal seems reasonable to me.

@iuioiua
Copy link
Contributor Author

iuioiua commented Jul 16, 2024

I'll merge in a few days if no strong objections arise.

@iuioiua iuioiua mentioned this pull request Jul 18, 2024
8 tasks
@iuioiua iuioiua merged commit 2759686 into main Jul 19, 2024
14 checks passed
@iuioiua iuioiua deleted the dotenv-remove-examplePath branch July 19, 2024 03:46
fabricionaweb added a commit to fabricionaweb/logs.moe that referenced this pull request Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

proposal: remove examplePath option from @std/dotenv/load
2 participants