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

Support absolute paths with the --env-file CLI option. #51625

Closed
virtuallyunknown opened this issue Jan 31, 2024 · 2 comments
Closed

Support absolute paths with the --env-file CLI option. #51625

virtuallyunknown opened this issue Jan 31, 2024 · 2 comments
Labels
feature request Issues that request new features to be added to Node.js.

Comments

@virtuallyunknown
Copy link

What is the problem this feature will solve?

Well, the problem is really simple. Right now when you pass a file to --env-file such as:

node --env-file=.env

It will load correctly, provided you have a file called .env relative to the current working directory (as stated in the documentation).

However, if you call the command with an absolute path such as:

node --env-file=/home/user/some/path/.env

It will throw an error, even if the file exists:

node: /home/user/some/path/.env: not found

What is the feature you are proposing to solve the problem?

I propose that passing an absolute path to --env-file would detect it as such and try to load the file. Also, the current error message could be improved.

Supporting absolute paths might sounds like a niche feature, but it can be very useful in the context of mono-repositories.

What alternatives have you considered?

No response

@virtuallyunknown virtuallyunknown added the feature request Issues that request new features to be added to Node.js. label Jan 31, 2024
@anonrig
Copy link
Member

anonrig commented Jan 31, 2024

Support for absolute paths are already landed in main and will be included in the next release.

Ref: #51425

@anonrig anonrig closed this as completed Jan 31, 2024
@virtuallyunknown
Copy link
Author

Support for absolute paths are already landed in main and will be included in the next release.

Ref: #51425

Oh, I apologize. Should've researched more thoroughly before opening an issue, my bad.

But also cheers for implementing the feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js.
Projects
None yet
Development

No branches or pull requests

2 participants