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

Add option to override duplicate settings #152

Merged
merged 2 commits into from
Dec 20, 2019
Merged

Add option to override duplicate settings #152

merged 2 commits into from
Dec 20, 2019

Conversation

thomastrapp
Copy link
Contributor

This pull request adds a new option as suggested in #83: CONFIG_OPTION_ALLOW_OVERRIDES.

libconfig rejects settings with duplicate names by default. With this option enabled, libconfig will instead remove the old setting and add the new one.

host = "example.com";
# remove setting "host" and add new setting "host":
host = "github.com";

My primary use case is using @include to setup defaults and then overriding specific settings.
For example:

unit = {
  # defaults.conf sets "delay" and other settings
  @include "defaults.conf"
  delay = 2000;
};

If there is anything that I can do to get this merged, please let me know.

libconfig rejects settings with duplicate names by default.
With this option enabled, libconfig will instead remove the old
setting and add the new one.
Copy link
Owner

@hyperrealm hyperrealm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, I would just ask that you please update libconfig.texi to document this new flag (and also add this flag to the C++ API).

@thomastrapp
Copy link
Contributor Author

I have adjusted the documentation for the C and C++ API. I made the assumption that the option will be available in libconfig v1.7.3: (@b{Since @i{v1.7.3}}).

If there is anything else to fix, please let me know. Thank you for merging!

@hyperrealm hyperrealm merged commit f53e5de into hyperrealm:master Dec 20, 2019
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

Successfully merging this pull request may close these issues.

2 participants