You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.9 KiB
58 lines
1.9 KiB
using Infrastructure.Email;
|
|
using Infrastructure.Events;
|
|
using Infrastructure.Sms;
|
|
using Infrastructure.UI;
|
|
using IoT.UI.Shard;
|
|
using IoTCenter.Services;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.AspNetCore.Routing;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace IoTCenter
|
|
{
|
|
public class Startup : IoTServiceStartup
|
|
{
|
|
private readonly IWebHostEnvironment _env;
|
|
|
|
public Startup(IConfiguration configuration, IWebHostEnvironment env) : base(configuration, env)
|
|
{
|
|
this._env = env;
|
|
}
|
|
|
|
public override void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddTransient<IEmailSender, EmptyEmailSender>();
|
|
services.AddTransient<ISmsSender, EmptySmsSender>();
|
|
services.AddTransient<IEventPublisher, EventPublisher>();
|
|
services.AddTransient<EventJob>();
|
|
services.AddSingleton<HealthCheckService>();
|
|
base.ConfigureServices(services);
|
|
}
|
|
|
|
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
|
|
{
|
|
base.Configure(app, env, loggerFactory);
|
|
Task.Run(() =>
|
|
{
|
|
app.ApplicationServices.GetService<HealthCheckService>().Start();
|
|
});
|
|
}
|
|
|
|
public override void ConfigureOptions(IServiceCollection services)
|
|
{
|
|
Console.WriteLine(IoT.Resources.Resource.WebFolder);
|
|
services.ConfigureOptions(new FileConfigureOptions(_env, new List<string> { "IoT.Shared", "IoT.Resources" }));
|
|
}
|
|
|
|
public override void UseSignalR(IEndpointRouteBuilder endpoints)
|
|
{
|
|
this.UseSignalR<PageHub>(endpoints);
|
|
}
|
|
}
|
|
} |