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

Configuration API changes (absolute file paths no longer supported) #166

Open
HaoK opened this issue Apr 1, 2016 · 0 comments
Open

Configuration API changes (absolute file paths no longer supported) #166

HaoK opened this issue Apr 1, 2016 · 0 comments

Comments

@HaoK
Copy link
Member

HaoK commented Apr 1, 2016

For more details see: aspnet/Configuration#407

Overview of changes:

  • IConfigurationSource has been introduced to represent the settings/configuration which is used to Build() a IConfigurationProvider. It is no longer possible to access the provider instances from IConfigurationBuilder only the sources. This is intentional, but may cause loss of functionality as you can longer do things like explicitly call Load() on the provider instances.
  • FileConfigurationProvider base class has been introduced as a common root for Json/Xml/Ini providers. This allows the ability to specify an IFileProvider on the source which will be used to read the file instead of explicitly using File.Open. The side effect of this change is that absolute paths are no longer supported, the file path must be relative to the base path of the IConfigurationBuilder's basepath or the IFileProvider if specified.
  • Example of configuring sources:
new ConfigurationBuilder()
      .SetBasePath(@"C:\SomeOherDirectory")
      .AddIni("baz.ini")
      .AddIni("whoops.ini", optional: true)
      .AddJson(source => {
          source.Path = "foo.json";
          source.Optional = true;
          source.ReloadOnChanged = false;
       }).AddXml(source => {
          source.Path = "bar.xml";
          source.Optional = true;
          source.ReloadOnChanged = false;
       }).Build();

cc @divega @shirhatti @lodejard

@HaoK HaoK added this to the 1.0.0-rc2 milestone Apr 1, 2016
@aspnet aspnet locked and limited conversation to collaborators Apr 1, 2016
@HaoK HaoK changed the title Configuration API changes (absolute files no longer supported) Configuration API changes (absolute file paths no longer supported) Apr 1, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant