Closed FlawTECH closed 6 months ago
@FlawTECH are you sure it does this? I've just double checked:
// index.js
require('dotenv').config()
console.log('Hello ' + process.env.HELLO)
# .env.example
HELLO="example"
output of node index.js
Hello undefined
P.S. you can use dotenvx genexample to auto-generate your .env.example
files
Apologies, you are indeed correct. I tried in a clean environment (something I should have done in the first place) and I don't reproduce the issue. Something must be poisoning my main project's environment.
Sorry for the trouble.
Hi, I have a project in which I supply a .env.example with the default values for easier deployment. Anyone who wants to deploy this project then has to copy this file to a .env file and adjust configuration as needed.
I was expecting dotenv to automatically load the .env file by default, but it seems .env.example is prioritized if present over .env. How do I prevent this from happening ?
I tried supplying
{ path: ['.env'] }
but even that doesn't seem to work.