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 May 6, 2024 via pnpm

dotenv-expand 10.0.0

Expand environment variables using dotenv
Package summary
Share
0
issues
1
license
1
BSD-2-Clause
Package created
21 Jan 2016
Version published
16 Dec 2022
Maintainers
1
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-expand@10.0.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-expand 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does dotenv-expand do?

Dotenv-expand is a useful tool for adding variable expansion on top of dotenv. It is useful in scenarios where you need to expand environment variables that already exist on your machine. The package allows you to define your environment variables within a .env file and automatically expand these variables within your JavaScript code.

How do you use dotenv-expand?

To use dotenv-expand, you would first need to install it via npm by running the command npm install dotenv-expand or if you are using yarn, it would be yarn add dotenv-expand. You should then create a .env file in the root directory of your project and define your environment variables within this file. For example:

PASSWORD="s1mpl3"
DB_PASS=$PASSWORD

Then, within your application code, you should import and configure dotenv and then expand dotenv as shown:

var dotenv = require('dotenv')
var dotenvExpand = require('dotenv-expand')
var myEnv = dotenv.config()
dotenvExpand.expand(myEnv)
console.log(process.env)

This way, you can access the expanded values of the keys that you defined in your .env file through process.env. There is also a feature for preloading dotenv & dotenv-expand where you won't need require and load dotenv or dotenv-expand in your code.

Where are the dotenv-expand docs?

The official documentation of dotenv-expand can be found on its GitHub page at https://github.com/motdotla/dotenv-expand. The documentation covers features such as usage, installation, variable expansion rules, and dotenv-expand's API. For further examples of using dotenv-expand, the tests/.env file in the package's GitHub repository contains both simple and complex examples of variable expansion in a .env file. The repository also contains a comprehensive guide on contributing to dotenv-expand.