feat(transport): add TransportOptions

This commit is contained in:
Joseph Doherty
2026-05-24 03:58:07 -04:00
parent 7e51274812
commit c5bd5418ad
3 changed files with 18 additions and 1 deletions

View File

@@ -7,6 +7,10 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../ScadaLink.Commons/ScadaLink.Commons.csproj" />
<ProjectReference Include="../ScadaLink.ConfigurationDatabase/ScadaLink.ConfigurationDatabase.csproj" />

View File

@@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
namespace ScadaLink.Transport;
@@ -9,7 +10,8 @@ public static class ServiceCollectionExtensions
public static IServiceCollection AddTransport(this IServiceCollection services)
{
ArgumentNullException.ThrowIfNull(services);
// Concrete services and options binding added in later tasks.
services.AddOptions<TransportOptions>().BindConfiguration(OptionsSection);
// Concrete services added in later tasks.
return services;
}
}

View File

@@ -0,0 +1,11 @@
namespace ScadaLink.Transport;
public sealed class TransportOptions
{
public int BundleSessionTtlMinutes { get; set; } = 30;
public int MaxBundleSizeMb { get; set; } = 100;
public int MaxUnlockAttemptsPerSession { get; set; } = 3;
public int MaxUnlockAttemptsPerIpPerHour { get; set; } = 10;
public int Pbkdf2Iterations { get; set; } = 600_000;
public int SchemaVersionMajor { get; set; } = 1;
}