H Vs 6 miesięcy temu
rodzic
commit
7be84755b0
1 zmienionych plików z 20 dodań i 6 usunięć
  1. +20
    -6
      TelpoKafkaConsole.WebApi/Program.cs

+ 20
- 6
TelpoKafkaConsole.WebApi/Program.cs Wyświetl plik

@@ -1,4 +1,5 @@
using Microsoft.Extensions.Configuration;
using Microsoft.OpenApi.Models;
using Serilog;
using TelpoKafkaConsole.Model;
using TelpoKafkaConsole.Service;
@@ -47,15 +48,28 @@ namespace TelpoKafkaConsole.WebApi
var app = builder.Build();

// Configure the HTTP request pipeline.
//if (app.Environment.IsDevelopment())
//{
// app.UseSwagger();
// app.UseSwaggerUI();
//}
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
}
else
{
var prefix = "kafkaconsole";
app.UseSwagger(c =>
{
c.PreSerializeFilters.Add((swagger, httpReq) =>
{
var scheme = httpReq.Headers.TryGetValue("X-Forwarded-Proto", out var v2) ? v2.ToString() : httpReq.Scheme;
swagger.Servers = new List<OpenApiServer> { new OpenApiServer { Url = $"{scheme}://{httpReq.Host}/{prefix}" } };
});
});
}

app.UseSwagger();
app.UseSwaggerUI();



app.UseAuthorization();

app.UseMiddleware<LoggingMiddleware>();


Ładowanie…
Anuluj
Zapisz