48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using Dlhis.Middle.BackgroundServices;
|
|
using Dlhis.Middle.Services;
|
|
using Kurisu.AspNetCore;
|
|
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.AddHostedService<BalanceRecordUploadBackgroundService>();
|
|
services.AddHostedService<HealthCheckBackgroundService>();
|
|
|
|
services.AddRemoteCall(App.ActiveTypes);
|
|
services.AddMemoryCache();
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
|
{
|
|
base.Configure(app, env);
|
|
|
|
if (Configuration.GetSection("Download").Value == "1")
|
|
{
|
|
using var scope = app.ApplicationServices.CreateScope();
|
|
var factories = scope.ServiceProvider.GetService<ISettingService>().GetFactories();
|
|
var ds = scope.ServiceProvider.GetService<IDataDownloadService>();
|
|
ds.InitAsync(factories).Wait();
|
|
}
|
|
}
|
|
} |