From 893b44565c7cebfb0f024c45ab9456170fdf3ec5 Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 16 Mar 2026 15:17:57 +0100 Subject: [PATCH] Enable Swagger via config and add project version metadata Added versioning fields to FakeNTLMServer.csproj for assembly and informational versioning. Introduced "EnableSwagger" setting in appsettings.json to allow Swagger UI outside development environments. Reformatted authentication registration in Program.cs for clarity. --- FakeNTLMServer.csproj | 4 ++++ Program.cs | 6 +++--- appsettings.json | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/FakeNTLMServer.csproj b/FakeNTLMServer.csproj index 6e1eaf0..9e6c40c 100644 --- a/FakeNTLMServer.csproj +++ b/FakeNTLMServer.csproj @@ -4,6 +4,10 @@ net8.0 enable enable + 1.0.0-beta + 1.0.0.0 + 1.0.0.0 + 1.0.0-beta diff --git a/Program.cs b/Program.cs index d22627e..ee8a152 100644 --- a/Program.cs +++ b/Program.cs @@ -7,8 +7,8 @@ var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllers(); -builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme) - .AddNegotiate(); + builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme) + .AddNegotiate(); builder.Services.AddAuthorization(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); @@ -52,7 +52,7 @@ builder.Services.AddSwaggerGen(options => var app = builder.Build(); // Configure the HTTP request pipeline. -if (app.Environment.IsDevelopment()) +if (app.Environment.IsDevelopment() || app.Configuration.GetValue("EnableSwagger")) { app.UseSwagger(); app.UseSwaggerUI(options => diff --git a/appsettings.json b/appsettings.json index fd414e6..8eca5de 100644 --- a/appsettings.json +++ b/appsettings.json @@ -10,5 +10,6 @@ "EndpointDefaults": { "Protocols": "Http1" } - } + }, + "EnableSwagger": true }