Skip to content
gohacks.dev
DevOps

.env File Parser and Converter

Parse a .env file, flag duplicate keys and unquoted spaces, and convert it to Docker Compose, docker run flags, a Kubernetes ConfigMap or Secret, or JSON.

Free · No sign-up · Your inputs stay in your browser

Input

Parse and convert a .env file

Output

Converted

7 variables

Line 7: MAIL_FROM_NAME has an unquoted space. Docker Compose reads it, but sourcing the file in a shell will not; quote it.

Line 8: APP_ENV is also set on line 2. Most loaders keep the last one; Laravel (phpdotenv) keeps the first.

Duplicate keys keep the last value here, as Docker Compose does. A Kubernetes Secret is only base64-encoded, not encrypted; anyone who can read it in the cluster can decode it.

Runs in this browser. Nothing you paste is sent to a server.

There is no .env standard

Each loader has its own rules. phpdotenv, which Laravel uses, does not overwrite a variable that already exists, so the first definition in the file wins over a later one; Docker Compose and Node's dotenv keep the last. Compose treats quotes and inline comments differently from a shell that sources the file. Quote every value containing spaces or a # and the differences mostly disappear.

Secrets in Kubernetes

A Kubernetes Secret's data is base64-encoded, not encrypted. Anyone allowed to read Secrets in the namespace can decode them, so restrict that with RBAC and enable encryption at rest for etcd.

Share

Frequently asked questions

Why does Laravel ignore a value I changed in .env?
Configuration is cached. Run php artisan config:clear, or config:cache again after editing; with a cached config, env() returns null outside the config files.
Should .env be committed to Git?
No. Commit a .env.example with the keys and safe defaults, and keep real values in the deployment's secret store.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools