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

dotenv-expand

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dotenv-expand - npm Package Compare versions

Comparing version 7.0.0 to 8.0.0

11

CHANGELOG.md

@@ -5,5 +5,14 @@ # Changelog

## [Unreleased](https://github.com/motdotla/dotenv-expand/compare/v6.0.1...master)
## [Unreleased](https://github.com/motdotla/dotenv-expand/compare/v8.0.0...master)
## [8.0.0](https://github.com/motdotla/dotenv-expand/compare/v7.0.0...v8.0.0) (2022-02-03)
### Changed
- _Breaking:_ Bump to `v16.0.0` of dotenv
### Added
- Preload support 🎉 ([#31](https://github.com/motdotla/dotenv-expand/pull/31))
## [7.0.0](https://github.com/motdotla/dotenv-expand/compare/v6.0.1...v7.0.0) (2022-01-17)

@@ -10,0 +19,0 @@

4

package.json
{
"name": "dotenv-expand",
"version": "7.0.0",
"version": "8.0.0",
"description": "Expand environment variables using dotenv",

@@ -37,3 +37,3 @@ "main": "lib/main.js",

"@types/node": "^17.0.8",
"dotenv": "^15.0.0",
"dotenv": "^16.0.0",
"lab": "^14.3.4",

@@ -40,0 +40,0 @@ "should": "^11.2.1",

@@ -22,3 +22,2 @@ <p align="center">

# Install locally (recommended)
npm install dotenv --save
npm install dotenv-expand --save

@@ -31,20 +30,13 @@ ```

Usage is a cinch!
Create a `.env` file in the root of your project:
### 1. Create a .env file with variable expansions in the root directory of your project
```dosini
# .env file
#
# Add environment-specific variables on new lines in the form of NAME=VALUE
#
PASSWORD=s1mpl3
DB_HOST=localhost
DB_USER=root
PASSWORD="s1mpl3"
DB_PASS=$PASSWORD
```
### 2. As early as possible in your application, import dotenv and expand with dotenv-expand
As early as possible in your application, import and configure dotenv and then expand dotenv:
```js
```javascript
var dotenv = require('dotenv')

@@ -59,6 +51,28 @@ var dotenvExpand = require('dotenv-expand')

### 3. That's it! 👏
That's it. `process.env` now has the expanded keys and values you defined in your `.env` file.
`process.env` now has the expanded keys and values you defined in your `.env` file.
### Preload
You can use the `--require` (`-r`) [command line option](https://nodejs.org/api/cli.html#cli_r_require_module) to preload dotenv & dotenv-extend. By doing this, you do not need to require and load dotenv or dotenv-extend in your application code. This is the preferred approach when using `import` instead of `require`.
```bash
$ node -r dotenv-extend/config your_script.js
```
The configuration options below are supported as command line arguments in the format `dotenv_config_<option>=value`
```bash
$ node -r dotenv-extend/config your_script.js dotenv_config_path=/custom/path/to/your/env/vars
```
Additionally, you can use environment variables to set configuration options. Command line arguments will precede these.
```bash
$ DOTENV_CONFIG_<OPTION>=value node -r dotenv-extend/config your_script.js
```
```bash
$ DOTENV_CONFIG_ENCODING=latin1 node -r dotenv-extend/config your_script.js dotenv_config_path=/custom/path/to/.env
```
## Examples

@@ -135,28 +149,4 @@

### Preload
You can use the `--require` (`-r`) [command line option](https://nodejs.org/api/cli.html#cli_r_require_module) to preload dotenv & dotenv-extend. By doing this, you do not need to require and load dotenv or dotenv-extend in your application code. This is the preferred approach when using `import` instead of `require`.
```bash
$ node -r dotenv-extend/config your_script.js
```
The configuration options below are supported as command line arguments in the format `dotenv_config_<option>=value`
```bash
$ node -r dotenv-extend/config your_script.js dotenv_config_path=/custom/path/to/your/env/vars
```
Additionally, you can use environment variables to set configuration options. Command line arguments will precede these.
```bash
$ DOTENV_CONFIG_<OPTION>=value node -r dotenv-extend/config your_script.js
```
```bash
$ DOTENV_CONFIG_ENCODING=latin1 node -r dotenv-extend/config your_script.js dotenv_config_path=/custom/path/to/.env
```
## Who's using dotenv-expand?
[These npm modules depend on it.](https://www.npmjs.com/browse/depended/dotenv-expand)
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