You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
796 B
29 lines
796 B
using Ocelot.DependencyInjection;
|
|
using Ocelot.Middleware;
|
|
//using Ocelot.Provider.Nacos;
|
|
using Ocelot.Provider.Polly;
|
|
using Tiobon.Core.Extensions;
|
|
|
|
namespace Tiobon.Core.Gateway.Extensions;
|
|
|
|
public static class CustomOcelotSetup
|
|
{
|
|
public static void AddCustomOcelotSetup(this IServiceCollection services)
|
|
{
|
|
if (services == null) throw new ArgumentNullException(nameof(services));
|
|
|
|
services.AddAuthentication_JWTSetup();
|
|
services.AddOcelot()
|
|
.AddDelegatingHandler<CustomResultHandler>()
|
|
//.AddNacosDiscovery()
|
|
//.AddConsul()
|
|
.AddPolly();
|
|
}
|
|
|
|
public static async Task<IApplicationBuilder> UseCustomOcelotMildd(this IApplicationBuilder app)
|
|
{
|
|
await app.UseOcelot();
|
|
return app;
|
|
}
|
|
|
|
}
|
|
|