Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 14, 2024 via pnpm

dotenv 14.1.0

Loads environment variables from .env file
Package summary
Share
0
issues
1
license
1
BSD-2-Clause
Package created
5 Jul 2013
Version published
17 Jan 2022
Maintainers
4
Total deps
1
Direct deps
0
License
BSD-2-Clause

Issues

0
This package has no issues

Licenses

BSD 2-Clause "Simplified" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
dotenv@14.1.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of dotenv 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does dotenv do?

Dotenv is a zero-dependency module in the Node.js ecosystem. It loads environment variables from a .env file into process.env, providing an easy way to configure and manage environment variables separate from your code, based on the methodology of The Twelve-Factor App. This allows developers to store configuration in the environment, facilitating the adjustment of behavior without the need to modify the codebase, thus making it easier to manage different states of the application like development, testing, and production.

How do you use dotenv?

To utilize dotenv in your application, follow this simple guide. Firstly, ensure that you have installed it locally in your project by using npm install dotenv. After that, create a .env file at the root of your project and add your environment-specific configurations like your API keys or database passwords. For example:

S3_BUCKET="YOURS3BUCKET"
SECRET_KEY="YOURSECRETKEYGOESHERE"

In your application code, import and configure dotenv as early as possible using the following code:

require('dotenv').config()
console.log(process.env) // remove this after you've confirmed it is working

For ES6 syntax usage:

import 'dotenv/config'

Thereafter, process.env will contain the keys and values defined in your .env file:

require('dotenv').config()

// your code here...
s3.getBucketCors({Bucket: process.env.S3_BUCKET}, function(err, data) {})

Where are the dotenv docs?

Dotenv offers comprehensive and detailed documentation for its users. You can access the official Dotenv documentation at its GitHub repository here. Among the subjects laid out are installation guidelines, usage cases, alternate setups, parsing rules, and more. This readme document from GitHub is the primary source of Dotenv documentation.