@ns84/dotenv
v1.0.0
Published
Loads environment variables from a file
Downloads
4
Readme
@ns84/dotenv
Loads the environment variables from a .env file into process.env.
By default, it loads a file named .env in the current working directory. To
load a specific .env file, specify its path.
This function works exactly like process.loadEnvFile except that it does not
throw an error if the file doesn't exist.
For information on the format for .env files, see DotEnv.
Installation
npm install @ns84/dotenvUsage
import { dotenv } from "@ns84/dotenv";
// Load environment variables from a file named `.env` (the default filename).
dotenv();
// Load environment variables from a file named `dev.env`.
dotenv("dev.env");
// Unlike `process.loadEnvFile` if the file doesn't exist, no error is thrown.
dotenv("fake.env");