Uh oh!
There was an error while loading. Please reload this page.
src: parse dotenv with the rest of the options - #54913
Conversation
nodejs-github-bot
commented
Sep 12, 2024
Review requested:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #54913 +/- ##
==========================================
+ Coverage 88.39% 88.40% +0.01%
==========================================
Files 652 654 +2 Lines 186777 187649 +872 Branches 36039 36093 +54 ==========================================
+ Hits 165109 165899 +790 - Misses 14917 14994 +77 - Partials 6751 6756 +5
🚀 New features to boost your workflow:
|
targos
commented
Sep 13, 2024
If it fixes a lot of things, shouldn't it add a lot of tests? |
avivkeller
commented
Sep 13, 2024
Tests have been added + rebased. |
targos
left a comment
There was a problem hiding this comment.
The way the test is done is not very robust: if the error message changes in the future, it will be wrong but still pass. It would be better to assert the actual error
avivkeller
commented
Sep 15, 2024
The failed GitHub tests are flakes, could someone start a CI? I don't have the permissions to start one without approvals |
avivkeller
commented
Sep 16, 2024
I have to incorporate #53060 |
BoscoDomingo
commented
Sep 16, 2024
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
anonrig
left a comment
There was a problem hiding this comment.
Can you rebase your branch with main, with the recent changes, it is extremely hard to review.
I'm currently facing the problem of: The files aren't parsed in the same order they were supplied. It's loading all of the optionals, then all of the normals. Any ideas? |
BoscoDomingo
commented
Sep 17, 2024
Well you are grabbing them all by creating vectors and referencing those via You're likely respecting argument order inside each vector, it's just you're segregating them by optionality first |
avivkeller
commented
Sep 17, 2024
Exactly... I just don't know how to fix that. |
It's one thing that e.g. |
avivkeller
commented
Sep 17, 2024
I fixed the issue by iterating over the arguments. It's kind of a mix between what was done previously. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
avivkeller
commented
Sep 22, 2024
I'm not a expert CPP developer, so LMK if I made a mistake. |
As shocking as it may seem, all Github failures are unrelated flakes. @anonrig is this better to what you had in mind? |
xduugu
commented
Sep 26, 2024
First of all, thanks a lot for still working on a proper fix for the env file option issues, @redyetidev.
I saw that you already fixed it, but maybe it could be solved much easier: From my understanding, the order of My proposed solution is, first reading all the "required" env files in the order they appear in the option list, then all "optional" ones, and adding a note about the env file processing order to the documentation. |
avivkeller
commented
Sep 26, 2024
IMHO the current setup makes more sense, that is, parse in the order the options where passed. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
avivkeller
commented
Oct 10, 2024
I've modified the implementation to use a new |
@anonrig are you still blocking? I think I've resolved all your concerns. As for the string copying, I believe it's needed, as other functions are expecting a string. |
Uh oh!
There was an error while loading. Please reload this page.
avivkeller
commented
Oct 29, 2024
PTAL @nodejs/cpp-reviewers |
Uh oh!
There was an error while loading. Please reload this page.
avivkeller
commented
Nov 5, 2024
Any other concerns, @lemire? |
lemire
commented
Nov 5, 2024
@redyetidev I don't have any concern, but I'd like to hear what @anonrig has to say about this PR. He is still asking for changes which I consider blocking. One thing is certain: this has been opened in September. We should do something with it. |
Closes#54385Fixes#54255
Ref #54232
I don't think this breaks anything. IIUC, the Dotenv parser was setup before everything else so that it triggered before V8 initialized, however, even it's setup after the options are parsed, V8 still hasn't been initialized, so it should be fine.
This fixes all currently known dotenv edge cases, as it doesn't need a custom parser.
Such as:
node script.js --env-file .env node --env-file-ABCD .env node -- --env-file .env node --invalid --env-file .env # this would've errored, but the env file is still parsed