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

Merge node config and custom config deeply #1407

Open
3 tasks
brusherru opened this issue Jul 26, 2023 · 0 comments · May be fixed by #1418
Open
3 tasks

Merge node config and custom config deeply #1407

brusherru opened this issue Jul 26, 2023 · 0 comments · May be fixed by #1418
Assignees

Comments

@brusherru
Copy link
Member

Rationale

Sometimes we need to change some nested properties and we don't want to nail other properties (to make it possible to update them via discovery).
For example:

{
  "main": {
    "poet-server": ["https://mainnet-poet-0.spacemesh.network"]
  },
  "p2p": {
    "disable-reuseport": true
  }
}

Acceptance criteria

  • It deeply merges the custom config on top of the config fetched from the discovery
  • It deeply merges only Objects, other types (primitives and arrays) are just replaced. So if you want to append some values to the array — copy-paste the entire array from the original config and append the required value to it.
  • If User specified "someProp": null — merging configs should omit someProp key

Example

// config in discovery
{
  a: 123,
  b: { c: { d: 5, e: 7, f: 10 }, x: 10, y: 15, z: 20 },
}

// custom config
{
  a: 256,
  b: {
    c: { d: 6, e: null },
    x: null,
    z: 25
}

// config result
{
  a: 256,
  b: {
    c: { d: 6, f: 10 },
    y: 15,
    z: 25
  }
}
@brusherru brusherru self-assigned this Jul 26, 2023
@brusherru brusherru linked a pull request Aug 1, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📋 Backlog
Development

Successfully merging a pull request may close this issue.

1 participant