Execute commands with environment variables from .env files.
- Load environment variables from
.env
files - Support profile-based environment files (
.env.{profile}
) - Priority-based directory search (current directory >
$XDG_CONFIG_HOME/envdo
) - Execute any command with loaded environment variables
- Display loaded environment variables in export format
$ envdo -- echo $MY_VAR
$ envdo --profile production -- node app.js
$ envdo -p dev -- npm start
$ envdo
export API_KEY=your_api_key
export DATABASE_URL=postgresql://localhost/mydb
envdo searches for .env
files in the following directories in order of priority:
- Current directory
$XDG_CONFIG_HOME/envdo
(typically~/.config/envdo
)
# Comments are supported
API_KEY=your_api_key
DATABASE_URL=postgresql://localhost/mydb
# Quoted values are supported
SECRET="my secret value"
ANOTHER_SECRET='another secret'
When using the --profile
option, envdo looks for .env.{profile}
files:
$ envdo --profile production -- node app.js
# Loads .env.production
homebrew tap:
$ brew install k1LoW/tap/envdo
manually:
Download binary from releases page
go install:
$ go install github.com/k1LoW/envdo@latest
deb:
$ export ENVDO_VERSION=X.X.X
$ curl -o envdo.deb -L https://github.com/k1LoW/envdo/releases/download/v$ENVDO_VERSION/envdo_$ENVDO_VERSION-1_amd64.deb
$ dpkg -i envdo.deb
RPM:
$ export ENVDO_VERSION=X.X.X
$ yum install https://github.com/k1LoW/envdo/releases/download/v$ENVDO_VERSION/envdo_$ENVDO_VERSION-1_amd64.rpm