@webbies.dev/dotenvify
v2.0.2
Published
Convert messy environment variables into clean .env files
Maintainers
Readme
DotEnvify
Turn messy key-value text into a clean .env file — from the command line.
You paste this:
API_KEY
a1b2c3d4e5f6g7h8i9j0
DATABASE_URL
postgres://user:password@localhost:5432/dbYou get this:
API_KEY=a1b2c3d4e5f6g7h8i9j0
DATABASE_URL="postgres://user:password@localhost:5432/db"Keys are sorted, values that need quotes get quoted, and your existing .env is
backed up before anything is written.
Install
npm install -g @webbies.dev/dotenvify
# or run it once, without installing:
npx @webbies.dev/dotenvify vars.txt -o .envUsage
dotenvify <source> [options]<source> is the file you want to convert.
| Option | Short | What it does |
|---------------------|-------|------------------------------------------------------|
| --output <file> | -o | Where to write (default: .env) |
| --export | -e | Add an export prefix to every line |
| --overwrite | -f | Overwrite without making a backup |
| --preserve <vars> | -k | Keep current values for these keys (comma-separated) |
| --skip-sort | | Keep the original order instead of sorting |
| --skip-lower | | Drop keys that contain lowercase letters |
| --url-only | | Keep only values that are URLs |
Input it understands
You can mix any of these in one file — DotEnvify figures out each line. Lines
starting with # are left alone.
API_KEY=a1b2c3d4e5f6g7h8i9j0 # already KEY=VALUE
SECRET="my secret value" # quoted
export NODE_ENV=production # export prefix (removed)
REDIS_HOST localhost # separated by a space
DATABASE_URL # key on one line,
postgres://user:pass@localhost/db # value on the nextJetBrains plugin
Prefer working in your IDE? The same conversion is available inside IntelliJ,
WebStorm, PyCharm, GoLand, Rider, and other JetBrains IDEs, plus Azure DevOps
variable-group import and .env diagnostics. Install it from the
Marketplace.
License
MIT — see LICENSE.
