Move servers to LBPU.PL.Servers

This commit is contained in:
jvyden 2022-05-14 23:37:55 -04:00
commit b2ec7eae57
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
116 changed files with 173 additions and 162 deletions

View file

@ -0,0 +1,61 @@
using LBPUnion.ProjectLighthouse.Startup;
using LBPUnion.ProjectLighthouse.Startup.Middlewares;
using Microsoft.AspNetCore.HttpOverrides;
namespace LBPUnion.ProjectLighthouse.Servers.Website.Startup;
public sealed class WebsiteStartup
{
public WebsiteStartup(IConfiguration configuration)
{
this.Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
#if DEBUG
services.AddRazorPages().WithRazorPagesAtContentRoot().AddRazorRuntimeCompilation();
#else
services.AddRazorPages().WithRazorPagesAtContentRoot();
#endif
services.AddDbContext<Database>();
services.Configure<ForwardedHeadersOptions>
(
options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
}
);
#if DEBUG
services.AddSingleton<IHostLifetime, DebugWarmupLifetime>();
#else
services.AddSingleton<IHostLifetime, ConsoleLifetime>();
#endif
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
#if DEBUG
app.UseDeveloperExceptionPage();
#endif
app.UseForwardedHeaders();
app.UseMiddleware<RequestLogMiddleware>();
app.UseRouting();
app.UseStaticFiles();
app.UseEndpoints(endpoints => endpoints.MapControllers());
app.UseEndpoints(endpoints => endpoints.MapRazorPages());
}
}