Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dotenv

Package Overview
Dependencies
Maintainers
4
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dotenv

Loads environment variables from .env file

  • 8.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
41M
decreased by-3.31%
Maintainers
4
Weekly downloads
 
Created

What is dotenv?

The dotenv npm package is used to load environment variables from a .env file into process.env, providing a convenient way to configure your application's environment during development. It helps in managing sensitive credentials and configuration options by keeping them out of the codebase.

What are dotenv's main functionalities?

Basic Configuration

This is the simplest use case for dotenv. By calling `require('dotenv').config();`, dotenv reads the .env file, parses the contents, and loads them into `process.env`. After this, environment variables can be accessed using `process.env.VAR_NAME`.

require('dotenv').config();

Custom Path

If your .env file is not located in the root directory or you have multiple .env files, you can specify a custom path to your .env file using the `path` option.

require('dotenv').config({ path: '/custom/path/to/.env' });

Debugging

To assist in debugging, you can enable debug output by setting the `debug` option to `true`. This will log any errors to the console while reading the .env file.

require('dotenv').config({ debug: process.env.DEBUG });

Other packages similar to dotenv

Keywords

FAQs

Package last updated on 18 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc