https://github.com/chenasraf/direnv-dotenvx
A direnv plugin to load .env or .env.{env} files using dotenvx, with automatic variable detection and shell-safe exports.
https://github.com/chenasraf/direnv-dotenvx
automation bash developer-tools direnv dotenv dotenvx env environment plugin shell
Last synced: 4 months ago
JSON representation
A direnv plugin to load .env or .env.{env} files using dotenvx, with automatic variable detection and shell-safe exports.
- Host: GitHub
- URL: https://github.com/chenasraf/direnv-dotenvx
- Owner: chenasraf
- License: mit
- Created: 2025-06-18T19:48:41.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2025-06-18T20:37:20.000Z (4 months ago)
- Last Synced: 2025-06-18T21:20:59.843Z (4 months ago)
- Topics: automation, bash, developer-tools, direnv, dotenv, dotenvx, env, environment, plugin, shell
- Language: Shell
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# direnv-dotenvx
A simple direnv extension to automatically load environment variables from `.env` files using
[dotenvx](https://dotenvx.com/).## 📦 Installation
### Homebrew
```sh
brew install chenasraf/tap/direnv-dotenvx
# or
brew tap chenasraf/tap
brew install direnv-dotenvx
```### Manual
1. Clone the repo somewhere:
```sh
mkdir -p ~/.config/direnv/lib
git clone https://github.com/chenasraf/direnv-dotenvx ~/.config/direnv/lib/direnv-dotenvx
```2. Symlink or source the loader:
```sh
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`:
```sh
use_dotenvx # loads .env or .env.default
use_dotenvx dev # loads .env.dev
```Then run:
```sh
direnv allow
```## 🔒 Security Note
> ⚠️ `direnv` applies only explicitly exported variables from the `.envrc` environment. `dotenvx`
> handles `.env` files without needing `export` statements, so your `.env` or `.env.*` files should
> use the standard `KEY=value` format. Always review your environment files before allowing `direnv`
> to apply them, as they affect your local shell environment.## 📝 License
MIT
## Contributing
I am developing this package on my free time, so any support, whether code, issues, or just stars is
very helpful to sustaining its life. If you are feeling incredibly generous and would like to donate
just a small amount to help sustain this project, I would be very very thankful!I welcome any issues or pull requests on GitHub. If you find a bug, or would like a new feature,
don't hesitate to open an appropriate issue and I will do my best to reply promptly.