Seenginx/Seenginx/Startup.cs

82 lines
2.1 KiB
C#
Raw Normal View History

2020-04-12 01:37:24 +02:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
2020-04-19 03:04:46 +02:00
using Blazorise;
2020-04-24 00:18:16 +02:00
using Blazorise.Bulma;
using Blazorise.Icons.FontAwesome;
2020-04-12 01:37:24 +02:00
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
2020-04-12 20:01:46 +02:00
using Seenginx.Services;
2020-04-19 03:04:46 +02:00
using Seenginx.Services.Models;
2020-04-12 01:37:24 +02:00
namespace Seenginx
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
2020-04-13 00:21:36 +02:00
services.AddRazorPages()
#if DEBUG
.AddRazorRuntimeCompilation()
#endif
;
2020-04-12 01:37:24 +02:00
services.AddServerSideBlazor();
2020-04-19 03:04:46 +02:00
services.AddBlazorise(options =>
{
options.ChangeTextOnKeyPress = true; // optional
2020-04-24 21:27:44 +02:00
}).AddBulmaProviders();
2020-04-19 03:04:46 +02:00
var configPaths = new ConfigPaths();
2020-04-24 00:18:16 +02:00
configPaths.NginxPath = @"C:\nginx\";
2020-04-19 03:04:46 +02:00
configPaths.SystemDPath = @"C:\systemd\system\";
services.AddSingleton(configPaths);
2020-04-13 00:21:36 +02:00
services.AddTransient<IDmesgService, DmesgService>();
services.AddTransient<INginxService, NginxService>();
services.AddTransient<ISystemDService, SystemDService>();
2020-04-12 01:37:24 +02:00
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
app.UseRouting();
2020-04-24 00:18:16 +02:00
app.ApplicationServices
2020-04-24 21:27:44 +02:00
.UseBulmaProviders();
2020-04-24 00:18:16 +02:00
2020-04-12 20:01:46 +02:00
app.UseAuthentication();
2020-04-12 01:37:24 +02:00
app.UseEndpoints(endpoints =>
{
endpoints.MapBlazorHub();
endpoints.MapFallbackToPage("/_Host");
});
}
}
}