Support for dotenv (`.env`) files
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
.envfiles in any folder - we do not want to add
package.jsonand install additional packages - fetching data from remote or any other operation might need credentials that could be stored in these
.envfile
Related
https://github.com/google/zx/pull/327
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
You can use this
require('dotenv').config({ path: __dirname+'/.env' });
can i work on this feature?
latest node support process.loadEnvFile(envVarsPath); out of the box