🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

@dotenvx/dotenvx

Package Overview
Dependencies
Maintainers
2
Versions
265
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.61.6
to
1.62.0
+1
-1
package.json
{
"version": "1.61.6",
"version": "1.62.0",
"name": "@dotenvx/dotenvx",

@@ -4,0 +4,0 @@ "description": "secrets for agents–from the creator of `dotenv`",

@@ -11,2 +11,3 @@ const path = require('path')

const conventions = require('./../../lib/helpers/conventions')
const { determine } = require('./../../lib/helpers/envResolution')

@@ -49,2 +50,3 @@ async function run () {

}
envs = determine(envs, process.env)

@@ -51,0 +53,0 @@ const {

@@ -5,2 +5,6 @@ const conventions = require('./conventions')

function buildEnvs (options) {
if (options.envs) {
return options.envs
}
// build envs using user set option.path

@@ -7,0 +11,0 @@ const optionPaths = dotenvOptionPaths(options) // [ '.env' ]

@@ -54,2 +54,11 @@ import type { URL } from 'url';

/**
* Specify explicit env sources. When set, `path` and `convention` are ignored.
*
* @default undefined
* @example require('@dotenvx/dotenvx').config({ envs: [{ type: 'envFile', value: '.env' }] })
* @example require('@dotenvx/dotenvx').config({ envs: [{ type: 'env', value: 'HELLO=World', privateKeyName: 'DOTENV_PRIVATE_KEY' }] })
*/
envs?: DotenvConfigEnv[];
/**
* Specify a custom path if your file containing environment variables is located elsewhere.

@@ -165,2 +174,17 @@ * Can also be an array of strings, specifying multiple paths.

export type DotenvConfigEnv =
| DotenvConfigEnvFile
| DotenvConfigEnvSrc;
export interface DotenvConfigEnvFile {
type: 'envFile';
value: string | URL;
}
export interface DotenvConfigEnvSrc {
type: 'env';
value: string | Buffer;
privateKeyName?: string;
}
export interface DotenvConfigOutput {

@@ -167,0 +191,0 @@ error?: Error;

@@ -19,2 +19,3 @@ // @ts-check

const buildEnvs = require('./helpers/buildEnvs')
const { determine } = require('./helpers/envResolution')
const Parse = require('./helpers/parse')

@@ -54,3 +55,6 @@ const fsx = require('./helpers/fsx')

try {
const envs = buildEnvs(options)
let envs = buildEnvs(options)
if (!options.envs) {
envs = determine(envs, processEnv)
}
const {

@@ -57,0 +61,0 @@ processedEnvs,

const Run = require('./run')
const Errors = require('./../helpers/errors')
const { determine } = require('./../helpers/envResolution')

@@ -16,3 +17,4 @@ class Get {

const processEnv = { ...process.env }
const { processedEnvs } = new Run(this.envs, this.overload, processEnv, this.envKeysFilepath, this.noOps).runSync()
const envs = determine(this.envs, processEnv)
const { processedEnvs } = new Run(envs, this.overload, processEnv, this.envKeysFilepath, this.noOps).runSync()
return this._result(processedEnvs, processEnv)

@@ -23,3 +25,4 @@ }

const processEnv = { ...process.env }
const { processedEnvs } = await new Run(this.envs, this.overload, processEnv, this.envKeysFilepath, this.noOps).run()
const envs = determine(this.envs, processEnv)
const { processedEnvs } = await new Run(envs, this.overload, processEnv, this.envKeysFilepath, this.noOps).run()
return this._result(processedEnvs, processEnv)

@@ -26,0 +29,0 @@ }

@@ -18,9 +18,5 @@ const fsx = require('./../helpers/fsx')

const {
determine
} = require('./../helpers/envResolution')
class Run {
constructor (envs = [], overload = false, processEnv = process.env, envKeysFilepath = null, noOps = false) {
this.envs = determine(envs, processEnv)
this.envs = envs
this.overload = overload

@@ -50,3 +46,3 @@ this.processEnv = processEnv

} else if (env.type === TYPE_ENV) {
this._injectEnv(env.value)
this._injectEnv(env.value, env.privateKeyName)
}

@@ -77,3 +73,3 @@ }

} else if (env.type === TYPE_ENV) {
this._injectEnv(env.value)
this._injectEnv(env.value, env.privateKeyName)
}

@@ -92,3 +88,3 @@ }

_injectEnv (env) {
_injectEnv (env, privateKeyName = null) {
const row = {}

@@ -99,2 +95,4 @@ row.type = TYPE_ENV

try {
const privateKey = privateKeyName ? this.processEnv[privateKeyName] || null : null
const {

@@ -105,4 +103,6 @@ parsed,

preExisted
} = new Parse(env, null, this.processEnv, this.overload).run()
} = new Parse(env, privateKey, this.processEnv, this.overload, privateKeyName).run()
row.privateKeyName = privateKeyName
row.privateKey = privateKey
row.parsed = parsed

@@ -109,0 +109,0 @@ row.errors = errors

Sorry, the diff of this file is too big to display