mirror of
https://github.com/volodymyrsmirnov/MalwareMultiScan.git
synced 2025-08-24 05:22:22 +00:00
49 lines
1.5 KiB
C#
49 lines
1.5 KiB
C#
using System.Diagnostics.CodeAnalysis;
|
|
using MalwareMultiScan.Api.Extensions;
|
|
using MalwareMultiScan.Api.Services.Implementations;
|
|
using MalwareMultiScan.Api.Services.Interfaces;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace MalwareMultiScan.Api
|
|
{
|
|
[ExcludeFromCodeCoverage]
|
|
internal class Startup
|
|
{
|
|
private readonly IConfiguration _configuration;
|
|
|
|
public Startup(IConfiguration configuration)
|
|
{
|
|
_configuration = configuration;
|
|
}
|
|
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddDockerForwardedHeadersOptions();
|
|
|
|
services.Configure<KestrelServerOptions>(options =>
|
|
{
|
|
options.Limits.MaxRequestBodySize = _configuration.GetValue<int>("MaxFileSize");
|
|
});
|
|
|
|
services.AddMongoDb(_configuration);
|
|
services.AddRabbitMq(_configuration);
|
|
|
|
services.AddSingleton<IScanBackendService, ScanBackendService>();
|
|
services.AddSingleton<IScanResultService, ScanResultService>();
|
|
|
|
services.AddControllers();
|
|
|
|
services.AddHostedService<ReceiverHostedService>();
|
|
}
|
|
|
|
public void Configure(IApplicationBuilder app)
|
|
{
|
|
app.UseRouting();
|
|
app.UseForwardedHeaders();
|
|
app.UseEndpoints(endpoints => endpoints.MapControllers());
|
|
}
|
|
}
|
|
} |