Skip to content

Commit

Permalink
Reduced JSON configuration section nesting. (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgernand authored Dec 13, 2022
1 parent 9766fdd commit 092ca0b
Show file tree
Hide file tree
Showing 31 changed files with 133 additions and 251 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<ProjectReference Include="..\..\src\Fluxera.Extensions.Hosting.Modules.Messaging.InMemory\Fluxera.Extensions.Hosting.Modules.Messaging.InMemory.csproj" />
<ProjectReference Include="..\..\src\Fluxera.Extensions.Hosting.Modules.Messaging.TransactionalOutbox\Fluxera.Extensions.Hosting.Modules.Messaging.TransactionalOutbox.csproj" />
<ProjectReference Include="..\..\src\Fluxera.Extensions.Hosting.Modules.Persistence.EntityFrameworkCore\Fluxera.Extensions.Hosting.Modules.Persistence.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\src\Fluxera.Extensions.Hosting.Modules.Persistence.EntityFrameworkCore\Fluxera.Extensions.Hosting.Modules.Persistence.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\Example.Domain\Example.Domain.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace Fluxera.Extensions.Hosting.Modules.AspNetCore.Authentication
{
using Fluxera.Extensions.DependencyInjection;
using Fluxera.Extensions.Hosting.Modules.Configuration;
using JetBrains.Annotations;
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.Configuration;
Expand All @@ -20,7 +19,7 @@ public override void PreConfigureServices(IServiceConfigurationContext context)
// Add the authentication services.
AuthenticationBuilder builder = context.Log("AddAuthentication", services =>
{
IConfigurationSection section = context.Configuration.GetSection(ConfigurationSectionUtil.GetSectionName("AspNetCore:Authentication"));
IConfigurationSection section = context.Configuration.GetSection("AspNetCore:Authentication");
AuthenticationOptions authenticationOptions = section.Get<AuthenticationOptions>();
return services.AddAuthentication(options =>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public abstract class ConfigureOptionsContributorBase<TOptions> : IConfigureOpti
public void Configure(IServiceConfigurationContext context)
{
string optionsTypeName = typeof(TOptions).Name;
IConfigurationSection section = context.Configuration.GetSection(ConfigurationSectionUtil.GetSectionName(this.SectionName));
IConfigurationSection section = context.Configuration.GetSection(this.SectionName);
TOptions options = section.Get<TOptions>() ?? new TOptions();

// Configure as IOptions<T>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<PackageReference Include="Fluxera.Entity" Version="7.0.5" />
<PackageReference Include="Fluxera.Enumeration" Version="7.0.4" />
<PackageReference Include="Fluxera.Extensions.Hosting" Version="7.0.4" />
<PackageReference Include="Fluxera.Repository" Version="7.0.4" />
<PackageReference Include="Fluxera.Repository" Version="7.0.5" />
<PackageReference Include="Fluxera.ValueObject" Version="7.0.3" />
<PackageReference Include="GitVersion.MsBuild" Version="5.11.1">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public sealed class TenantOptions
/// </summary>
public TenantOptions()
{
this.Enabled = false;
this.Enabled = true;
this.Mode = MultiTenancyMode.DatabasePerTenant;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace Fluxera.Extensions.Hosting.Modules.OpenTelemetry
{
using System;
using Fluxera.Extensions.Hosting.Modules.Configuration;
using global::OpenTelemetry.Logs;
using JetBrains.Annotations;
using Microsoft.Extensions.Configuration;
Expand All @@ -24,7 +23,7 @@ public static IHostBuilder AddOpenTelemetryLogging(this IHostBuilder builder, Ac
{
return builder.ConfigureLogging((context, loggingBuilder) =>
{
IConfigurationSection section = context.Configuration.GetSection(ConfigurationSectionUtil.GetSectionName("OpenTelemetry"));
IConfigurationSection section = context.Configuration.GetSection("OpenTelemetry");
OpenTelemetryOptions telemetryOptions = section.Get<OpenTelemetryOptions>() ?? new OpenTelemetryOptions();
loggingBuilder.AddOpenTelemetry(loggerOptions =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<ItemGroup>
<PackageReference Include="Fluxera.Extensions.Hosting" Version="7.0.4" />
<PackageReference Include="Fluxera.Repository.EntityFrameworkCore" Version="7.0.4" />
<PackageReference Include="Fluxera.Repository.EntityFrameworkCore" Version="7.0.5" />
<PackageReference Include="GitVersion.MsBuild" Version="5.11.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<ItemGroup>
<PackageReference Include="Fluxera.Extensions.Hosting" Version="7.0.4" />
<PackageReference Include="Fluxera.Repository.InMemory" Version="7.0.4" />
<PackageReference Include="Fluxera.Repository.InMemory" Version="7.0.5" />
<PackageReference Include="GitVersion.MsBuild" Version="5.11.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<ItemGroup>
<PackageReference Include="Fluxera.Extensions.Hosting" Version="7.0.4" />
<PackageReference Include="Fluxera.Repository.LiteDB" Version="7.0.4" />
<PackageReference Include="Fluxera.Repository.LiteDB" Version="7.0.5" />
<PackageReference Include="GitVersion.MsBuild" Version="5.11.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<ItemGroup>
<PackageReference Include="Fluxera.Extensions.Hosting" Version="7.0.4" />
<PackageReference Include="Fluxera.Repository.MongoDB" Version="7.0.4" />
<PackageReference Include="Fluxera.Repository.MongoDB" Version="7.0.5" />
<PackageReference Include="GitVersion.MsBuild" Version="5.11.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
<PackageReference Include="Fluxera.Extensions.Hosting" Version="7.0.4" />
<PackageReference Include="Fluxera.Extensions.Validation.DataAnnotations" Version="7.0.3" />
<PackageReference Include="Fluxera.Extensions.Validation.FluentValidation" Version="7.0.3" />
<PackageReference Include="Fluxera.Repository" Version="7.0.4" />
<PackageReference Include="Fluxera.Repository.OpenTelemetry" Version="7.0.4" />
<PackageReference Include="Fluxera.Repository" Version="7.0.5" />
<PackageReference Include="Fluxera.Repository.OpenTelemetry" Version="7.0.5" />
<PackageReference Include="GitVersion.MsBuild" Version="5.11.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,50 +1,46 @@
{
"Hosting": {
"Modules": {
"AspNetCore": {
"Authentication": {
"DefaultScheme": "ApiKey-Second",
"Schemes": {
"ApiKey": {
"Default": {
"Realm": "MyApiKeyRealm-1",
"KeyName": "X-MyKey-1"
},
"Second": {
"Realm": "MyApiKeyRealm-2",
"KeyName": "X-MyKey-2"
}
},
"Basic": {
"Default": {
"Realm": "MyBasicRealm-1"
},
"Second": {
"Realm": "MyBasicRealm-2"
}
},
"Cookies": {
"Default": {
"Cookie": {
"Name": "_MyAuthCookie_1"
}
},
"Second": {
"Cookie": {
"Name": "_MyAuthCookie_2"
}
}
},
"JwtBearer": {
"Default": {
"Authority": "MyAuthority-1",
"SigningKey": "MySigningKey-1"
},
"Second": {
"Authority": "MyAuthority-2",
"SigningKey": "MySigningKey-2"
}
"AspNetCore": {
"Authentication": {
"DefaultScheme": "ApiKey-Second",
"Schemes": {
"ApiKey": {
"Default": {
"Realm": "MyApiKeyRealm-1",
"KeyName": "X-MyKey-1"
},
"Second": {
"Realm": "MyApiKeyRealm-2",
"KeyName": "X-MyKey-2"
}
},
"Basic": {
"Default": {
"Realm": "MyBasicRealm-1"
},
"Second": {
"Realm": "MyBasicRealm-2"
}
},
"Cookies": {
"Default": {
"Cookie": {
"Name": "_MyAuthCookie_1"
}
},
"Second": {
"Cookie": {
"Name": "_MyAuthCookie_2"
}
}
},
"JwtBearer": {
"Default": {
"Authority": "MyAuthority-1",
"SigningKey": "MySigningKey-1"
},
"Second": {
"Authority": "MyAuthority-2",
"SigningKey": "MySigningKey-2"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{
"Hosting": {
"Modules": {
"AspNetCore": {
"Cors": {
"Origins": [
"http://localhost:5000",
"https://localhost:5001"
]
}
}
"AspNetCore": {
"Cors": {
"Origins": [
"http://localhost:5000",
"https://localhost:5001"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
{
"Hosting": {
"Modules": {
"AspNetCore": {
"HttpApi": {
"Descriptions": {
"v1": {
"Version": "1.0",
"Title": "My API",
"Description": "This is my nice API."
},
"v2": {
"Version": "2.0",
"Title": "My API",
"Description": "This is my nice API."
}
}
"AspNetCore": {
"HttpApi": {
"Descriptions": {
"v1": {
"Version": "1.0",
"Title": "My API",
"Description": "This is my nice API."
},
"v2": {
"Version": "2.0",
"Title": "My API",
"Description": "This is my nice API."
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"Hosting": {
"Modules": {
"HttpPrincipal": {
}
}
}
"HttpPrincipal": {}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"Hosting": {
"Modules": {
"AspNetCore": {
"BaseUrl": "https://localhost:5001"
}
}
"AspNetCore": {
"BaseUrl": "https://localhost:5001"
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"Hosting": {
"Modules": {
"AutoMapper": {
}
}
}
"AutoMapper": {}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
{
"Hosting": {
"Modules": {
"Caching": {
"MemoryCache": {
"AbsoluteExpiration": "12:00:00",
"AbsoluteExpirationRelativeToNow": "00:30:00",
"SlidingExpiration": "00:15:00"
},
"DistributedCache": {
"AbsoluteExpiration": "12:00:00",
"AbsoluteExpirationRelativeToNow": "00:30:00",
"SlidingExpiration": "00:15:00"
},
"Redis": {
"ConnectionStringName": "RedisServer",
"InstanceName": "RedisInstance",
}
},
"Caching": {
"MemoryCache": {
"AbsoluteExpiration": "12:00:00",
"AbsoluteExpirationRelativeToNow": "00:30:00",
"SlidingExpiration": "00:15:00"
},
"DistributedCache": {
"AbsoluteExpiration": "12:00:00",
"AbsoluteExpirationRelativeToNow": "00:30:00",
"SlidingExpiration": "00:15:00"
},
"Redis": {
"ConnectionStringName": "RedisServer",
"InstanceName": "RedisInstance"
}
},
"ConnectionStrings": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
{
"Hosting": {
"Modules": {
"Caching": {
"DistributedCache": {
"AbsoluteExpiration": "12:00:00",
"AbsoluteExpirationRelativeToNow": "00:30:00",
"SlidingExpiration": "00:15:00"
}
}
"Caching": {
"DistributedCache": {
"AbsoluteExpiration": "12:00:00",
"AbsoluteExpirationRelativeToNow": "00:30:00",
"SlidingExpiration": "00:15:00"
}
}
}
Loading

0 comments on commit 092ca0b

Please sign in to comment.