autodotenv is a Zsh plugin inspired in dotenv plugin
It ask if you want load your project ENV variables from .env file when you cd into project root directory.
This plugin is
First clone project in zsh plugins folder
git clone $ZSH/custom/pluginsAnd add the plugin to your .zshrc:
plugins=(... autodotenv)Create .env file inside your project root directory and put your ENV variables there.
For example:
export AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a
export SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f
export MONGO_URI=mongodb://127.0.0.1:27017
export PORT=3001export is optional. This format works as well:
AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a
SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f
MONGO_URI=mongodb://127.0.0.1:27017
PORT=3001You can even mix both formats, although it's probably a bad idea.
If you would like the .env file to be loaded automatically without confirmation, you can set the AUTODOTENV_SKIP_CONFIRM environment variable to true in your .zshrc:
export AUTODOTENV_SKIP_CONFIRM=trueIt's strongly recommended to add .env file to .gitignore, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it's supposed to be local only.
This is plugin is a fork of the dotenv Zsh plugin. Is a simple project with optional .env load.