Skip to content

Using config with fallback as fallback for another config looses fallback values #196

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

Closed
IgorFedchenko opened this issue Jan 24, 2020 · 1 comment

Comments

@IgorFedchenko
Copy link
Contributor

IgorFedchenko commented Jan 24, 2020

The following fails:

var config = ConfigurationFactory.ParseString("a = 1");
var fallback = ConfigurationFactory.ParseString("b = 2");
var configWithFallback = config.WithFallback(fallback);

var anotherConfig = ConfigurationFactory.ParseString("c = 1");
var merged = anotherConfig.WithFallback(configWithFallback);
// Here we loose value that was fallback for configWithFallback
merged.GetInt("b").Should().Be(2);

When getting values from fallback config, need to get their fallbacks as well. Most likely this can be resolved with simple using Fallback.Root instead of Fallback.Value when building final config.

@IgorFedchenko
Copy link
Contributor Author

Ooops... Sorry, @Aaronontheweb - just verified, this issue is a mistake. I had a typo in the test, and fixed it in issue description only after fixed the Config implementation, so thought that it started working because of my fix...

Closing this.

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 a pull request may close this issue.

1 participant