NestJS tip: how to use Node.js built-in .env file reader with NestJS CLI
Micael Levi L. C.

Micael Levi L. C. @micalevisk

About: just run $ npx @micalevisk/card

Location:
Brazil
Joined:
Sep 8, 2018

NestJS tip: how to use Node.js built-in .env file reader with NestJS CLI

Publish Date: May 14 '24
3 0

Starting from Node.js v20.6.0 you can read dot env files into the process.env object using the --env-file=path nodejs option.

If you're using NestJS's CLI (@nestjs/cli package) you can turn on that Node.js option in two ways:

  1. nest start --exec "node --env-file=.env"
  2. For NestJS v11 or above: nest start --env-file .env

Comments 0 total

    Add comment