-
-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple & recursive expand #3
Conversation
Thanks for this. I'll take a look soon. |
I needed this feature for a project I'm working on, so I've been playing around with it. It seems to be overwriting preset variables (correct me if I'm wrong, but that's a bug). Reproduce: # .env
NODE_ENV=production $ NODE_ENV=development node ./index.js // index.js
const dotenv = require('dotenv')
const dotenvExpand = require('dotenv-expand')
dotenv.config()
console.log(process.env.NODE_ENV) //=> development (as expected)
dotenvExpand(dotenv.config())
console.log(process.env.NODE_ENV) //=> production (??) I've found a fix in this block: for (var configKey in config) {
var value = process.env[configKey] || config[configKey]
if (value.substring(0, 2) === '\\$') {
config[configKey] = value.substring(1)
} else {
config[configKey] = interpolate(value)
}
} The problem seems to be that |
Meh, this still isn't fixed and the readme is still outdated per #2? |
Any news? please? |
? |
Thank you everyone for this PR and for your patience. It just merged here: #5 |
Just published on npm as @kshvmdn 😱 you are absolutely right. I'll look into that right now. |
Expand multiple variables
Now you can expand multiple variables using
$
and${}
.Recursive expand
Multiple & recursive expand tests
Added more tests checking new functionalities.