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 for dotenv (.env) files #461

Open
joselcvarela opened this issue Jun 28, 2022 · 5 comments
Open

Support for dotenv (.env) files #461

joselcvarela opened this issue Jun 28, 2022 · 5 comments
Labels

Comments

@joselcvarela
Copy link

Expected Behavior

Support for dotenv files

Actual Behavior

Do not support dotenv files

Motivation

These files are specially useful in order to avoid to type same environment variables multiple times.
In some cases, it also can be helpful to track them with a version controller.

That being said, zx could support this behaviour because:

  • we may need these .env files in any folder
  • we do not want to add package.json and install additional packages
  • fetching data from remote or any other operation might need credentials that could be stored in these .env file

Related

#327

@nhonx
Copy link

nhonx commented Aug 11, 2022

I think we should make this issue in a more generic way, not just loading dotenv file. I suggest doing it similar to the way docker did: load env variables from .config file.
For example: zx --env-file=/foo/bar/cred.config script.mjs

@Cyberarray
Copy link

You can use this

require('dotenv').config({ path: __dirname+'/.env' });

@meanii
Copy link

meanii commented Mar 13, 2023

can i work on this feature?

@ziimakc
Copy link

ziimakc commented Apr 16, 2024

latest node support process.loadEnvFile(envVarsPath); out of the box

@Anonymous961
Copy link
Contributor

Can you please close this issue?
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants