Skip to content

Commit

Permalink
fix: Pass section name so that configuration is correctly resolved by…
Browse files Browse the repository at this point in the history
… name
  • Loading branch information
nickrandolph committed Mar 13, 2024
1 parent 4a25852 commit 02a1a72
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/Uno.Extensions.Configuration/ConfigBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,11 @@ public static IConfigBuilder Section<TSettingsOptions>(
{
if (configSection is null)
{
if (configurationSection is { Length: > 0 })
if (configurationSection is not { Length: > 0 })
{
configSection = ctx => ctx.Configuration.GetSection(configurationSection);
}
else
{
configSection = ctx => ctx.Configuration.GetSection(typeof(TSettingsOptions).Name);
configurationSection = typeof(TSettingsOptions).Name;
}
configSection = ctx => ctx.Configuration.GetSection(configurationSection);
}

static string? FilePath(HostBuilderContext hctx)
Expand Down Expand Up @@ -160,7 +157,7 @@ public static IConfigBuilder Section<TSettingsOptions>(
}

var section = configSection(ctx);
services.ConfigureAsWritable<TSettingsOptions>(section, configPath);
services.ConfigureAsWritable<TSettingsOptions>(section, configPath, configurationSection);
}

).AsConfigBuilder();
Expand Down

0 comments on commit 02a1a72

Please sign in to comment.