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

@dotenvx/dotenvx

Package Overview
Dependencies
Maintainers
2
Versions
187
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dotenvx/dotenvx - npm Package Compare versions

Comparing version 1.15.0 to 1.16.0

8

CHANGELOG.md

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

## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.15.0...main)
## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.16.0...main)
## 1.16.0
### Changed
* for `dotenvx keypair` call out to `dotenvx pro keypair` if [pro](https://github.com/dotenvx/dotenvx/issues/259) installed ([#390](https://github.com/dotenvx/dotenvx/pull/390))
## 1.15.0

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

2

package.json
{
"version": "1.15.0",
"version": "1.16.0",
"name": "@dotenvx/dotenvx",

@@ -4,0 +4,0 @@ "description": "a better dotenv–from the creator of `dotenv`",

@@ -1323,3 +1323,3 @@ [![dotenvx](https://dotenvx.com/better-banner.png)](https://dotenvx.com)

Print a shell formatted response of keypair(s).
Print a shell formatted reponse of public/private keys.

@@ -1326,0 +1326,0 @@ ```sh

const fs = require('fs')
const path = require('path')
const dotenv = require('dotenv')
const childProcess = require('child_process')

@@ -16,6 +17,8 @@ const ENCODING = 'utf8'

const parseEnvironmentFromDotenvKey = require('./../helpers/parseEnvironmentFromDotenvKey')
const smartDotenvPrivateKey = require('./../helpers/smartDotenvPrivateKey')
const guessPrivateKeyFilename = require('./../helpers/guessPrivateKeyFilename')
const guessPrivateKeyName = require('./../helpers/guessPrivateKeyName')
const detectEncoding = require('./../helpers/detectEncoding')
const Keypair = require('./../services/keypair')
class Run {

@@ -98,4 +101,3 @@ constructor (envs = [], overload = false, DOTENV_KEY = '', processEnv = process.env) {

// if DOTENV_PRIVATE_KEY_* already set in process.env then use it
const privateKey = smartDotenvPrivateKey(envFilepath)
const privateKey = this._determinePrivateKey(envFilepath)
const { parsed, processEnv, warnings } = parseDecryptEvalExpand(src, privateKey, this.processEnv)

@@ -275,4 +277,27 @@ row.parsed = parsed

}
_determinePrivateKey (envFilepath) {
const privateKeyName = guessPrivateKeyName(envFilepath)
let privateKey
try {
// if installed as sibling module
const projectRoot = path.resolve(process.cwd())
const dotenvxProPath = require.resolve('@dotenvx/dotenvx-pro', { paths: [projectRoot] })
const { keypair } = require(dotenvxProPath)
privateKey = keypair(envFilepath, privateKeyName)
} catch (_e) {
try {
// if installed as binary cli
privateKey = childProcess.execSync(`dotenvx-pro keypair ${privateKeyName} -f ${envFilepath} 2>/dev/null`).toString().trim()
} catch (_e) {
// fallback to local KeyPair - smart enough to handle process.env, .env.keys, etc
privateKey = new Keypair(envFilepath, privateKeyName).run()
}
}
return privateKey
}
}
module.exports = Run
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