Skip to content

webb1es/dotenvify

Repository files navigation

Dotenvify

Dotenvify

Turn messy key-value text into a clean .env file — from the command line or your JetBrains IDE.

npm   JetBrains Marketplace version   JetBrains Marketplace downloads   MIT


You paste this:

API_KEY
a1b2c3d4e5f6g7h8i9j0
DATABASE_URL
postgres://user:password@localhost:5432/db

You 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 .env

Usage

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 are entirely lowercase
--url-only Keep only values that are HTTP/HTTPS 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 next

JetBrains plugin

Do the same thing inside IntelliJ, WebStorm, PyCharm, GoLand, Rider, and other JetBrains IDEs — plus a couple of extras. Install it from the Marketplace.

  • Convert — paste or convert a file/selection to .env with a live preview.
  • Azure DevOps — sign in with the Azure CLI (az login), pick a variable group, and pull its variables into a .env file. Secret values stay in Azure. Needs the Azure CLI.
  • Diagnostics — find keys your code uses but the .env is missing, and keys in the .env that nothing uses.

Contributing

Building from source, the repo layout, and how releases work are in CONTRIBUTING.md.

License

MIT — see LICENSE.