How to Add Comment in .Env File


environment node.js

Hello! If you are from Ukraine, Belarus, Poland or India and looking for a job in Software Development, please reach me out by email.

Example

Usually we use .env for storing environment variables:

DB_HOST=host
DB_USER=admin
DB_PASS=pass

The values are pairs of keys and values. But how do we can add comments for our variables?

Definition and Usage

You can add a comment in .env by starting a line with a hash (#) symbol. E.g.

# host value
DB_HOST=host
# username
DB_USER=admin
# secure password
DB_PASS=pass

Lines started from # detected as comments.

comments powered by Disqus