using Microsoft.Extensions.DependencyInjection;
using Ocelot.DependencyInjection;
using Ocelot.Provider.Consul;
using Ocelot.Provider.Polly;
using Volo.Abp.Autofac;
using Volo.Abp.Modularity;
using Volo.Abp.Swashbuckle;
namespace CompanyName.ProjectName.Shared.Hosting.Gateways
{
[DependsOn(
typeof(AbpSwashbuckleModule),
typeof(AbpAutofacModule))]
public class SharedHostingGatewayModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
ConfigureOcelot(context);
ConfigureHealthChecks(context);
}
///
/// Ocelot配置
///
private static void ConfigureOcelot(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
context.Services.AddOcelot(configuration).AddConsul().AddPolly();
}
///
/// 健康检查
///
///
private void ConfigureHealthChecks(ServiceConfigurationContext context)
{
context.Services.AddHealthChecks();
}
}
}