51 lines
1.4 KiB
C#
51 lines
1.4 KiB
C#
using Dlhis.Middle.Services;
|
|
using Dlhis.Middle.Services.Implements;
|
|
using Kurisu.AspNetCore.Startup;
|
|
using Microsoft.IdentityModel.Logging;
|
|
|
|
namespace Dlhis.Middle;
|
|
|
|
class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
KurisuHost.Run<Startup>(args);
|
|
}
|
|
}
|
|
|
|
public class Startup : DefaultStartup
|
|
{
|
|
public Startup(IConfiguration configuration) : base(configuration)
|
|
{
|
|
IdentityModelEventSource.ShowPII = true;
|
|
}
|
|
|
|
public override void ConfigureServices(IServiceCollection services)
|
|
{
|
|
base.ConfigureServices(services);
|
|
services.AddHttpClient("face").ConfigurePrimaryHttpMessageHandler(() =>
|
|
{
|
|
var handler = new HttpClientHandler
|
|
{
|
|
ClientCertificateOptions = ClientCertificateOption.Manual,
|
|
ServerCertificateCustomValidationCallback = (_, _, _, _) => true
|
|
};
|
|
|
|
return handler;
|
|
});
|
|
services.AddHostedService<HealthCheckBackgroundService>();
|
|
services.AddMemoryCache();
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
|
{
|
|
base.Configure(app, env);
|
|
|
|
using var scope = app.ApplicationServices.CreateScope();
|
|
var factory = Configuration.GetSection("Factory").Value;
|
|
|
|
var ds = scope.ServiceProvider.GetService<IDataDownloadService>();
|
|
ds.InitAsync(factory).Wait();
|
|
}
|
|
} |