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

Overloading rules - shallow json merge #21

Closed
marcinczeczko opened this issue Oct 11, 2017 · 2 comments
Closed

Overloading rules - shallow json merge #21

marcinczeczko opened this issue Oct 11, 2017 · 2 comments

Comments

@marcinczeczko
Copy link

Is there a reason why config retriever merges config JSONs only at depth 1 ?
I have following case where config files is pretty big, so wanted to split it into smaller fragments, and let config retriever to merge it into on. In order to simplify management of configuration of my app, I wanted to split config files into two. For instance, first config file have:

{
   "a": {
       "b": {
           "foo": "bar"
       }
   }
}

In the second one, I wanted to configure other fields under a.b as follows (so keep "c" configurations in a separate file)

{
   "a": {
       "c": {
           "foo": "bar"
       }
   }
}

I configure retriever to get those two files (two file stores) and expected to get

{
   "a": {
       "b": {
           "foo": "bar"
       },
       "c": {
           "foo": "bar"
       }
   }
}

But the resulting configuration is the one from the second file. It simply overwrote the object "a" because the retriever does json.mergeIn(JsonObject) so it merges only on the level of "a" object.
Why it cannot do deep merge ? json.mergeIn(JsonObject, true) ?

@cescoffier
Copy link
Member

I believe it has already been fixed: 1d33cf9#diff-068b3a4e126c877ee327bca32d49fdc8

@marcinczeczko
Copy link
Author

I didn't notice I was still using 3.4.1 that had that issue.

Thanks

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

No branches or pull requests

2 participants