-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
47 lines (38 loc) · 1.27 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/** File Name: Program.cs
* By: Darian Benam (GitHub: https://github.com/BeardedFish/)
* Date: Tuesday, August 30, 2022 */
using DomainStatusReport.Services;
using DomainStatusReport.Services.Configuration;
using Microsoft.AspNetCore.HttpOverrides;
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
ApplicationConfig appConfig = new(builder.Configuration);
builder.Services.AddCors(setup =>
{
setup.AddDefaultPolicy(policy =>
{
policy.WithOrigins("https://benam.io", "https://dev.darianbenam.com", "https://www.darianbenam.com")
.AllowAnyHeader()
.AllowAnyMethod();
});
});
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<IApplicationConfig>(appConfig);
builder.Services.AddSingleton<IDomainStatusCheckerService, DomainStatusCheckerService>();
WebApplication app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
app.UseForwardedHeaders(new()
{
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});
app.UseStaticFiles();
app.UseRouting();
app.UseCors();
app.MapControllers();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");
app.Run();