mirror of
https://github.com/chenasraf/direnv-dotenvx.git
synced 2026-05-18 01:39:05 +00:00
08b79bea406ea002697be2ba7ab4cfc771d8c5ad
direnv-dotenvx
A simple direnv extension to automatically load environment variables from .env files using
dotenvx.
📦 Installation
- Clone the repo somewhere:
mkdir -p ~/.config/direnv/lib
git clone https://github.com/chenasraf/direnv-dotenvx ~/.config/direnv/lib/direnv-dotenvx
- Symlink or source the loader:
ln -s ~/.config/direnv/lib/direnv-dotenvx/use_dotenvx.sh ~/.config/direnv/lib/use_dotenvx.sh
✅ This makes the function use_dotenvx available in all .envrc files.
⚙️ Usage
In your .envrc:
use_dotenvx # loads .env or .env.default
use_dotenvx dev # loads .env.dev
Then run:
direnv allow
🔒 Security Note
⚠️
direnvapplies only explicitly exported variables from the.envrcenvironment.dotenvxhandles.envfiles without needingexportstatements, so your.envor.env.*files should use the standardKEY=valueformat. Always review your environment files before allowingdirenvto apply them, as they affect your local shell environment.
📝 License
MIT
Languages
Shell
100%