feat(Proxy): add logic tro enable swagger in production

This commit is contained in:
tekh 2025-08-27 16:16:23 +02:00
parent a63bccf47d
commit 6a4817cbcd
2 changed files with 7 additions and 1 deletions

View File

@ -32,8 +32,13 @@ try
app.UseMiddleware<ExceptionHandlingMiddleware>();
bool useSwagger = config.GetValue<bool>("UseSwagger");
if(useSwagger)
app.Services.GetRequiredService<ILogger<Program>>()
.LogWarning("Swagger UI is enabled. Using Swagger in a production environment may expose sensitive API information and pose security risks.");
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
if (app.Environment.IsDevelopment() || useSwagger)
{
app.UseSwagger();
app.UseSwaggerUI();

View File

@ -5,6 +5,7 @@
"Microsoft.AspNetCore": "Warning"
}
},
"UseSwagger": true,
"AllowedHosts": "*",
"EConnect": {
"BaseAddress": "https://portal.demoportal01.leanetec.com",