this post was submitted on 15 Nov 2023
2 points (100.0% liked)

Node.js

216 readers
4 users here now

founded 1 year ago
MODERATORS
 

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.

Find out more...

Here is an example of the changes needed to upgrade:

config.ts config.ts diff

package.json package.json diff

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.

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here