feat(transport): add TransportOptions
This commit is contained in:
@@ -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" />
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
11
src/ScadaLink.Transport/TransportOptions.cs
Normal file
11
src/ScadaLink.Transport/TransportOptions.cs
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user