Skip to content

Commit

Permalink
improve startup
Browse files Browse the repository at this point in the history
  • Loading branch information
damienbod committed Mar 9, 2024
1 parent 9698efc commit 679fd1d
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 65 deletions.
58 changes: 49 additions & 9 deletions IssueUnlockDoor/Program.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,58 @@
namespace IssueUnlockDoor;
using IssueUnlockDoor;

namespace EmployeeUnlockDoor;

public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
var builder = WebApplication.CreateBuilder(args);
var services = builder.Services;
var configuration = builder.Configuration;
var env = builder.Environment;

services.Configure<CredentialSettings>(configuration.GetSection("CredentialSettings"));
services.AddHttpClient();
services.AddScoped<IssuerService>();
services.AddDistributedMemoryCache();

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
services.Configure<CookiePolicyOptions>(options =>
{
webBuilder
.ConfigureKestrel(options => options.AddServerHeader = false)
.UseStartup<Startup>();
options.CheckConsentNeeded = context => false;
options.MinimumSameSitePolicy = SameSiteMode.None;
});

services.AddRazorPages();

var app = builder.Build();

app.UseSecurityHeaders(SecurityHeadersDefinitions
.GetHeaderPolicyCollection(env.IsDevelopment()));


if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
}

app.UseHttpsRedirection();
app.UseStaticFiles();

app.UseRouting();

app.UseAuthorization();

app.MapRazorPages();
app.MapControllers();

app.Run();
}
}




56 changes: 0 additions & 56 deletions IssueUnlockDoor/Startup.cs

This file was deleted.

0 comments on commit 679fd1d

Please sign in to comment.