Skip to content

Conversation

@anonrig
Copy link
Member

@anonrig anonrig commented Aug 17, 2023

Follow-up for #49148. Prior to this change, we were preferring the environment variables over .env file. Right now, we merge them.

Ref: #49148

cc @GeoffreyBooth @ljharb @tniessen @gireeshpunathil

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/startup

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Aug 17, 2023
@anonrig anonrig mentioned this pull request Aug 17, 2023
8 tasks
@anonrig anonrig force-pushed the merge-node-options branch from e797a45 to 9bf23ad Compare August 17, 2023 19:02
@anonrig anonrig requested a review from joyeecheung August 17, 2023 19:05
@tniessen
Copy link
Member

I am a little confused. Wasn't the opinion in #49148 that merging would be confusing and inconsistent with how the implementation treats other environment variables? Or does merging refer to something else here?

@anonrig
Copy link
Member Author

anonrig commented Aug 17, 2023

I am a little confused. Wasn't the opinion in #49148 that merging would be confusing and inconsistent with how the implementation treats other environment variables? Or does merging refer to something else here?

Referring to @targos's comment on the original PR (https://github.com/nodejs/node/pull/48890/files#r1294239790), it sort of makes sense to me to have an edge case for NODE_OPTIONS. The only case I can think of this makes sense is, people who have NODE_OPTIONS in their shell, will always override the NODE_OPTIONS settings in .env files, and might not even know why their code doesn't work.

@ljharb
Copy link
Member

ljharb commented Aug 17, 2023

I think the primary reason this can't work out well is that if one of the sources has --foo, there's not always going to be a --no-foo i can put in the other source to override it. In other words, without the overriding behavior, i wouldn't be able to prevent the other source's NODE_OPTIONS from remaining.

@GeoffreyBooth
Copy link
Member

I think it’s too confusing to special-case NODE_OPTIONS for merging when all other variable names are overwritten. It’s even weirder because there are Node environment variables that we can’t merge, like FORCE_COLOR=[1, 2, 3] or NODE_EXTRA_CA_CERTS=file. So the special case wouldn’t be “Node-supported environment variables are merged” but specifically only NODE_OPTIONS is.

I think the “proper” way to support merging is to support some kind of substitution syntax in the file, like

NODE_OPTIONS=${NODE_OPTIONS} --no-warnings

Then the user can explicitly control the merging, for any variable, and define how it’s done (is the file’s value prepended or appended, etc.).

@anonrig anonrig added the blocked PRs that are blocked by other issues or PRs. label Aug 17, 2023
@anonrig
Copy link
Member Author

anonrig commented Aug 17, 2023

I'm convinced by your arguments. I've added blocked label to not merge this. I'll keep the pull request open for a couple of days, in case someone with a good argument comes in. If not, I'll close it soon. Thanks everybody for their feedback and review.

@anonrig anonrig closed this Aug 21, 2023
@anonrig anonrig deleted the merge-node-options branch August 21, 2023 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked PRs that are blocked by other issues or PRs. c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants