motdotla / dotenv-expand

Variable expansion for dotenv. Expand variables already on your machine for use in your .env file.
https://dotenvx.com
BSD 2-Clause "Simplified" License
935 stars 93 forks source link

support `'single$quote'` syntax to not expand #112

Open motdotla opened 7 months ago

motdotla commented 7 months ago

add feature so that single quote syntax does not expand $ dollar signs. (this likely requires coordination with dotenv

who needs this? please let me know below.

jahdiel commented 7 months ago

This latest release broke my staging environemnt. My .env file has something similar to:

HOST="something"
DOMAIN="https://${HOST}"

During deployment the dotenv-expand upgraded to the latest release and broke during runtime. The expansion failed, DOMAIN ended up with https://${HOST} as its value. Not sure if this was a non-backwards compatible release.

motdotla commented 7 months ago

@jahdiel what version did you bump up from?

And does your HOST value have a $ dollar sign in it?

motdotla commented 7 months ago

@jahdiel nevermind. i see the issue. working on the fix. so sorry about this. in the meantime, you can fix it by changing your dotenv expand code from:

var dotenv = require('dotenv')
var dotenvExpand = require('dotenv-expand')
dotenvExpand.expand(dotenv.config())

to

var dotenv = require('dotenv')
var dotenvExpand = require('dotenv-expand')
dotenvExpand.expand(dotenv.config({ processEnv: {} }))
motdotla commented 7 months ago

@jahdiel - please install v11.0.3. should be fixed. https://github.com/motdotla/dotenv-expand/pull/113

sorry about this one. was a bad one. tests were formatted badly allowing it to sneak in. fixed going forward.