How to Add Comment in .Env File


environment node.js

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