2022-02-28 14:48:55 +00:00
|
|
|
|
using ASC.EventBus.Events;
|
|
|
|
|
|
|
|
|
|
var options = new WebApplicationOptions
|
2022-02-04 17:44:03 +00:00
|
|
|
|
{
|
|
|
|
|
Args = args,
|
|
|
|
|
ContentRootPath = WindowsServiceHelpers.IsWindowsService() ? AppContext.BaseDirectory : default
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var builder = WebApplication.CreateBuilder(options);
|
|
|
|
|
|
2022-03-29 20:29:03 +00:00
|
|
|
|
builder.Host.ConfigureDefault(args, (hostContext, config, env, path) =>
|
2022-02-04 17:44:03 +00:00
|
|
|
|
{
|
2022-03-29 20:29:03 +00:00
|
|
|
|
config.AddJsonFile("notify.json")
|
|
|
|
|
.AddJsonFile($"notify.{env.EnvironmentName}.json", true)
|
|
|
|
|
.AddJsonFile("backup.json");
|
2022-02-04 17:44:03 +00:00
|
|
|
|
});
|
|
|
|
|
|
2022-03-29 20:29:03 +00:00
|
|
|
|
builder.WebHost.ConfigureDefaultKestrel();
|
2022-02-04 17:44:03 +00:00
|
|
|
|
|
|
|
|
|
var startup = new Startup(builder.Configuration, builder.Environment);
|
|
|
|
|
|
|
|
|
|
startup.ConfigureServices(builder.Services);
|
|
|
|
|
|
|
|
|
|
builder.Host.ConfigureContainer<ContainerBuilder>(containerBuilder =>
|
|
|
|
|
{
|
|
|
|
|
startup.ConfigureContainer(containerBuilder);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
|
|
|
|
|
startup.Configure(app, app.Environment);
|
|
|
|
|
|
2022-02-14 11:18:58 +00:00
|
|
|
|
var eventBus = ((IApplicationBuilder)app).ApplicationServices.GetRequiredService<IEventBus>();
|
|
|
|
|
|
2022-02-24 16:53:49 +00:00
|
|
|
|
eventBus.Subscribe<BackupRequestIntegrationEvent, BackupRequestIntegrationEventHandler>();
|
2022-03-02 15:25:28 +00:00
|
|
|
|
eventBus.Subscribe<BackupRestoreRequestIntegrationEvent, BackupRestoreRequestIntegrationEventHandler>();
|
2022-02-28 14:48:55 +00:00
|
|
|
|
eventBus.Subscribe<IntegrationEvent, BackupDeleteScheldureRequestIntegrationEventHandler>();
|
2022-02-14 11:18:58 +00:00
|
|
|
|
|
2022-02-23 12:33:42 +00:00
|
|
|
|
app.Run();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public partial class Program
|
|
|
|
|
{
|
|
|
|
|
public static string Namespace = typeof(Startup).Namespace;
|
|
|
|
|
public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1);
|
|
|
|
|
}
|