dotenv-expand
Advanced tools
Comparing version 11.0.2 to 11.0.3
@@ -1,1 +0,1 @@ | ||
{"processes":{"4d323de8-58ec-4083-92a3-c3b2b7934cb5":{"parent":"7c12bfaf-8ba8-48e9-abb5-cc02dd678b85","externalId":"tests/main.js","children":[]},"7c12bfaf-8ba8-48e9-abb5-cc02dd678b85":{"parent":null,"children":["4d323de8-58ec-4083-92a3-c3b2b7934cb5"]}},"files":{"/Users/scottmotte/Code/motdotla/dotenv-expand/lib/main.js":["4d323de8-58ec-4083-92a3-c3b2b7934cb5"]},"externalIds":{"tests/main.js":{"root":"4d323de8-58ec-4083-92a3-c3b2b7934cb5","children":[]}}} | ||
{"processes":{"1ca85622-76a9-4a28-94e7-0ea0b35c7958":{"parent":"da8207f6-841d-4918-a3da-fca5f3b7c9c3","externalId":"tests/main.js","children":[]},"da8207f6-841d-4918-a3da-fca5f3b7c9c3":{"parent":null,"children":["1ca85622-76a9-4a28-94e7-0ea0b35c7958"]}},"files":{"/Users/scottmotte/Code/motdotla/dotenv-expand/lib/main.js":["1ca85622-76a9-4a28-94e7-0ea0b35c7958"]},"externalIds":{"tests/main.js":{"root":"1ca85622-76a9-4a28-94e7-0ea0b35c7958","children":[]}}} |
@@ -5,4 +5,10 @@ # Changelog | ||
## [Unreleased](https://github.com/motdotla/dotenv-expand/compare/v11.0.2...master) | ||
## [Unreleased](https://github.com/motdotla/dotenv-expand/compare/v11.0.3...master) | ||
## [11.0.3](https://github.com/motdotla/dotenv-expand/compare/v11.0.2...v11.0.3) (2024-02-11) | ||
### Changed | ||
- 🐞 bug fix when `processEnv` set to process.env rather than empty object (also test fixes which hid the bug) ([#113](https://github.com/motdotla/dotenv-expand/pull/113)) | ||
## [11.0.2](https://github.com/motdotla/dotenv-expand/compare/v11.0.1...v11.0.2) (2024-02-10) | ||
@@ -9,0 +15,0 @@ |
@@ -28,2 +28,6 @@ 'use strict' | ||
if (parsed[key]) { | ||
return parsed[key] | ||
} | ||
if (defaultValue) { | ||
@@ -37,3 +41,3 @@ if (defaultValue.startsWith('$')) { | ||
return parsed[key] || '' | ||
return '' | ||
} | ||
@@ -52,6 +56,14 @@ }) | ||
// don't interpolate if it exists already in processEnv | ||
if (Object.prototype.hasOwnProperty.call(processEnv, key)) { | ||
value = processEnv[key] | ||
const inProcessEnv = Object.prototype.hasOwnProperty.call(processEnv, key) | ||
if (inProcessEnv) { | ||
if (processEnv[key] === options.parsed[key]) { | ||
// assume was set to processEnv from the .env file if the values match and therefore interpolate | ||
value = interpolate(value, processEnv, options.parsed) | ||
} else { | ||
// do not interpolate - assume processEnv had the intended value even if containing a $. | ||
value = processEnv[key] | ||
} | ||
} else { | ||
// not inProcessEnv so assume interpolation for this .env key | ||
value = interpolate(value, processEnv, options.parsed) | ||
@@ -58,0 +70,0 @@ } |
{ | ||
"name": "dotenv-expand", | ||
"version": "11.0.2", | ||
"version": "11.0.3", | ||
"description": "Expand environment variables using dotenv", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
@@ -129,3 +129,3 @@ <div align="center"> | ||
See [tests/.env](https://github.com/motdotla/dotenv-expand/blob/master/tests/.env) for simple and complex examples of variable expansion in your `.env` | ||
See [tests/.env.test](https://github.com/motdotla/dotenv-expand/blob/master/tests/.env.test) for simple and complex examples of variable expansion in your `.env` | ||
file. | ||
@@ -190,4 +190,5 @@ | ||
* `${KEY:-default}` will first attempt to expand any env with the name `KEY`. If not one, then it will return `default` | ||
* `${KEY-default}` will first attempt to expand any env with the name `KEY`. If not one, then it will return `default` | ||
You can see a full list of examples [here](https://github.com/motdotla/dotenv-expand/blob/master/tests/.env). | ||
You can see a full list of rules [here](https://dotenvx.com/docs/env-file#interpolation). | ||
@@ -194,0 +195,0 @@ ## Contributing Guide |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24455
118
204