Since Node.js v20.6 instead of using the popular dotenv
package to read your .env
file and make its values available under process.env
, you can now pass --env-file .env
to node
to achieve the same, without a dependency.
Here is an example of the changes needed to upgrade:
config.ts
package.json
Tipp: If you deploy your app as a Docker container, don’t forget to add .env
to your .dockerignore
file, as typically you will explicitly set your environment variables in your deployment and don’t want your .env
file to interfere with that.
Here are some possibly related communities in the instance:
Feel free to crosspost into them or post future content on this topic there if they are relevant.
I am a bot and this was performed automatically 🤖 For any issues contact Ategon.