dotenv
This package is a zero-dependency module that loads environment variables from a .env file into process.env.
Install
$ npm i @alexconlag/dotenv
Usage
Create a .env
file in the root of your project:
SECRET_KEY=YOURSECRETKEYGOESHERE
OTHER_VAR=HEREYOURVAR
As early as possible in your application, import and configure dotenv:
import { config } from "@alexconlag/dotenv";
config();
console.log(process.env);