Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
damienbod committed Nov 15, 2024
1 parent 206bcf6 commit 2177dd3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions WebHybridFlowClient/HostingExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,16 @@ namespace WebHybridFlowClient;

internal static class HostingExtensions
{
private static IWebHostEnvironment? _env;

public static WebApplication ConfigureServices(this WebApplicationBuilder builder)
{
var services = builder.Services;
var configuration = builder.Configuration;
_env = builder.Environment;

services.AddSecurityHeaderPolicies()
.SetPolicySelector((PolicySelectorContext ctx) =>
{
return SecurityHeadersDefinitions
.GetHeaderPolicyCollection(_env!.IsDevelopment());
.GetHeaderPolicyCollection(builder.Environment.IsDevelopment());
});

services.AddTransient<ApiService>();
Expand Down Expand Up @@ -72,7 +69,7 @@ public static WebApplication ConfigurePipeline(this WebApplication app)

app.UseSecurityHeaders();

if (_env!.IsDevelopment())
if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
Expand Down

0 comments on commit 2177dd3

Please sign in to comment.