Skip to content

k1LoW/envdo

Repository files navigation

envdo

Execute commands with environment variables from .env files.

Features

  • 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

Usage

Basic usage

$ envdo -- echo $MY_VAR

With profile

$ envdo --profile production -- node app.js
$ envdo -p dev -- npm start

Show loaded environment variables

$ envdo
export API_KEY=your_api_key
export DATABASE_URL=postgresql://localhost/mydb

.env files

envdo searches for .env files in the following directories in order of priority:

  1. Current directory
  2. $XDG_CONFIG_HOME/envdo (typically ~/.config/envdo)

Basic .env file format

# 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'

Profile-based .env files

When using the --profile option, envdo looks for .env.{profile} files:

$ envdo --profile production -- node app.js
# Loads .env.production

Install

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

About

Execute commands with environment variables from .env files.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 3

  •  
  •  
  •