-
Notifications
You must be signed in to change notification settings - Fork 257
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
Nconf mutates defaults #315
Comments
|
Confirmed the issue here as well. It's a bug in /lib/nconf/stores/memory.js(200). If the value being merged is an object and a key of the same name doesn't exist in the target, the object reference is assigned rather than a copy. That works fine for a single merge, but once a subsequent merge happens nconf will start rewriting the referenced object. The same appears to be true for arrays. The code will need to be modified so that object and array values that don't exist in the target are deep cloned. |
So I think i'm running into this, but want to confirm. I'm creating a defaults object and one of the default values is a function that auto-generates a password. I'm usiing I'm intended to write a submit a PR for a new format called Toggle to view code
|
For those looking for a quick and dirty fix: Replace:
with
in memory.js |
For some reason,
nconf
mutates the value passed todefaults
:The text was updated successfully, but these errors were encountered: