upd: 网关swagger
This commit is contained in:
@ -25,6 +25,8 @@ namespace KonSoft.InternalGateway.Extensions
|
||||
.Select(t => t.First())
|
||||
.Distinct()
|
||||
.ToList();
|
||||
var gatewayUrl = configuration["GatewayUrl"];
|
||||
|
||||
foreach (var clusterGroup in groupedClusters)
|
||||
{
|
||||
var routeConfig = yarpConfig.Routes.FirstOrDefault(q =>
|
||||
@ -36,7 +38,7 @@ namespace KonSoft.InternalGateway.Extensions
|
||||
}
|
||||
|
||||
// options.SwaggerEndpoint($"{clusterGroup.Value.Address}/swagger/v1/swagger.json", $"{routeConfig.RouteId} API");
|
||||
options.SwaggerEndpoint(new Uri(new Uri(clusterGroup.Value.Address), "/swagger/v1/swagger.json").AbsoluteUri, $"{routeConfig.RouteId} API");
|
||||
options.SwaggerEndpoint(new Uri(new Uri(!string.IsNullOrWhiteSpace(gatewayUrl)? gatewayUrl: clusterGroup.Value.Address), "/swagger/v1/swagger.json").AbsoluteUri, $"{routeConfig.RouteId} API");
|
||||
options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]);
|
||||
options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ using KonSoft.InternalGateway;
|
||||
using KonSoft.InternalGateway.Extensions;
|
||||
using KonSoft.Shared.Hosting.AspNetCore;
|
||||
using Microsoft.AspNetCore.Rewrite;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Serilog;
|
||||
|
||||
@ -21,7 +22,11 @@ try
|
||||
.UseAutofac()
|
||||
.UseSerilog();
|
||||
|
||||
builder.Services.AddSwaggerGen(options =>
|
||||
builder.Services.AddAbpSwaggerGenWithOAuth(builder.Configuration["AuthServer:Authority"]!,
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
{ "Clean", "Clean API" }
|
||||
}, options =>
|
||||
{
|
||||
options.SwaggerDoc("v1", new OpenApiInfo
|
||||
{
|
||||
|
||||
@ -4,5 +4,10 @@
|
||||
"name": "KonSoft.InternalGateway",
|
||||
"nodes": "https://config.konsoft.top/",
|
||||
"secret": "DBE31703-14F9-4B01-893D-900B8380CE04"
|
||||
},
|
||||
"AuthServer": {
|
||||
"Authority": "https://localhost:44322",
|
||||
"RequireHttpsMetadata": true,
|
||||
"SwaggerClientId": "Gateway_Swagger"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user