Socket
Socket
Sign inDemoInstall

dotenv

Package Overview
Dependencies
0
Maintainers
3
Versions
86
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 16.2.0 to 16.3.0

8

CHANGELOG.md

@@ -5,4 +5,10 @@ # Changelog

## [Unreleased](https://github.com/motdotla/dotenv/compare/v16.2.0...master)
## [Unreleased](https://github.com/motdotla/dotenv/compare/v16.3.0...master)
## [16.3.0](https://github.com/motdotla/dotenv/compare/v16.2.0...v16.3.0) (2023-06-16)
### Added
- Optionally pass `DOTENV_KEY` to options rather than relying on `process.env.DOTENV_KEY`. Defaults to `process.env.DOTENV_KEY` [#754](https://github.com/motdotla/dotenv/pull/754)
## [16.2.0](https://github.com/motdotla/dotenv/compare/v16.1.4...v16.2.0) (2023-06-15)

@@ -9,0 +15,0 @@

2

lib/cli-options.js

@@ -1,2 +0,2 @@

const re = /^dotenv_config_(encoding|path|debug|override)=(.+)$/
const re = /^dotenv_config_(encoding|path|debug|override|DOTENV_KEY)=(.+)$/

@@ -3,0 +3,0 @@ module.exports = function optionMatcher (args) {

@@ -20,2 +20,6 @@ // ../config.js accepts options via environment variables

if (process.env.DOTENV_CONFIG_DOTENV_KEY != null) {
options.DOTENV_KEY = process.env.DOTENV_CONFIG_DOTENV_KEY
}
module.exports = options

@@ -61,3 +61,3 @@ const fs = require('fs')

// example: DOTENV_KEY="dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenv.org/vault/.env.vault?environment=prod"
const keys = _dotenvKey().split(',')
const keys = _dotenvKey(options).split(',')
const length = keys.length

@@ -103,3 +103,9 @@

function _dotenvKey () {
function _dotenvKey (options) {
// prioritize developer directly setting options.DOTENV_KEY
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
return options.DOTENV_KEY
}
// secondary infra already contains a DOTENV_KEY environment variable
if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {

@@ -109,2 +115,3 @@ return process.env.DOTENV_KEY

// fallback to empty string
return ''

@@ -218,3 +225,3 @@ }

// fallback to original dotenv if DOTENV_KEY is not set
if (_dotenvKey().length === 0) {
if (_dotenvKey(options).length === 0) {
return DotenvModule.configDotenv(options)

@@ -221,0 +228,0 @@ }

{
"name": "dotenv",
"version": "16.2.0",
"version": "16.3.0",
"description": "Loads environment variables from .env file",

@@ -5,0 +5,0 @@ "main": "lib/main.js",

@@ -245,2 +245,3 @@ <div align="center">

* [nodejs (override on)](https://github.com/dotenv-org/examples/tree/master/dotenv-nodejs-override)
* [nodejs (processEnv override)](https://github.com/dotenv-org/examples/tree/master/dotenv-custom-target)
* [esm](https://github.com/dotenv-org/examples/tree/master/dotenv-esm)

@@ -261,3 +262,3 @@ * [esm (preload)](https://github.com/dotenv-org/examples/tree/master/dotenv-esm-preload)

Dotenv exposes three functions:
Dotenv exposes four functions:

@@ -267,2 +268,3 @@ * `config`

* `populate`
* `decrypt`

@@ -343,2 +345,12 @@ ### Config

##### DOTENV_KEY
Default: `process.env.DOTENV_KEY`
Pass the `DOTENV_KEY` directly to config options. Defaults to looking for `process.env.DOTENV_KEY` environment variable. Note this only applies to decrypting `.env.vault` files. If passed as null or undefined, or not passed at all, dotenv falls back to its traditional job of parsing a `.env` file.
```js
require('dotenv').config({ DOTENV_KEY: 'dotenv://:key_1234…@dotenv.org/vault/.env.vault?environment=production' })
```
### Parse

@@ -345,0 +357,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc