🎉 Happy News! The new website is out :-) Google

dotenv

dotenv

Load .env files into your shell environment. Follows the twelve-factor app config principle. Supports variable interpolation, comments and multi-line values.

Installation

bpkg install bashup/dotenv

Usage

source bpkg_modules/dotenv/dotenv.sh

# Load default .env
dotenv

# Load specific file
dotenv .env.production

# Load and export all variables
dotenv --export .env

.env format

# This is a comment
DATABASE_URL=postgres://localhost/mydb
SECRET_KEY="my secret with spaces"
MULTILINE="line one\nline two"
INTERPOLATED="Hello $USER"

Notes

  • Existing environment variables are not overwritten by default
  • Use --override to force overwrite
  • export is not required in the file; use --export flag instead