dotenv-expand icon indicating copy to clipboard operation
dotenv-expand copied to clipboard

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

Open motdotla opened this issue 1 year ago • 4 comments

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.

motdotla avatar Feb 10 '24 18:02 motdotla

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.

jahdiel avatar Feb 10 '24 22:02 jahdiel

@jahdiel what version did you bump up from?

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

motdotla avatar Feb 11 '24 18:02 motdotla

@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 avatar Feb 11 '24 18:02 motdotla

@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.

motdotla avatar Feb 11 '24 20:02 motdotla