motdotla / dotenv

Loads environment variables from .env for nodejs projects.
https://www.dotenvx.com
BSD 2-Clause "Simplified" License
19.2k stars 859 forks source link

Using boolean expression inside the .env file #839

Closed bathiatuss closed 2 months ago

bathiatuss commented 2 months ago

I can't pass boolean variable on the .env file. I did quick search about this subject. The solution is you have to compare the data with a logical expression like this: " process.env.myBooleanData === 'true' ". Waiting for recommendation or solution.

motdotla commented 2 months ago

yes, that is the correct solution. .env files treat everything as strings.

motdotla commented 2 months ago

this is because all environment variables are stored as strings.