Skip to content
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.overrides won't merge as expected #71

Closed
gusverdywid opened this issue Feb 10, 2013 · 4 comments
Closed

nconf.overrides won't merge as expected #71

gusverdywid opened this issue Feb 10, 2013 · 4 comments

Comments

@gusverdywid
Copy link

Calling nconf.overrides the second time will replace every options set the first time.

nconf.overrides({
  modules1: {prop1: 'abc', prop2: 'def'}
});

// The following will replace every object in nconf.overrides specified before
nconf.overrides({
  moduleA: {newProp: 'foo'}
});

Am I doing it right? Is it the intended behavior of nconf.overrides?

@indexzero
Copy link
Owner

Yes. Why not merge these two objects up front before calling .overrides() a single time?

@gusverdywid
Copy link
Author

But sometimes the configuration may come from different modules. Is there any other way to override configurations in different modules or files and merge them together without retrieving the configuration first, merging them and later calling .overrides()?

@indexzero
Copy link
Owner

Just use a .set in those multiple modules.

@AndersDJohnson
Copy link

AndersDJohnson commented May 1, 2017

@indexzero What if we want to provide overrides at the top-level of the object from multiple places? set seems to require a key. Could iterate over get but that's dirty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants