mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-12-26 07:25:48 +08:00
Feat/monorepo (#734)
* copied everything from repos back to ocelot repo * added src projects to sln * removed all test projects that have no tests * added all test projects to sln * removed test not on master * merged unit tests * merged acceptance tests * merged integration tests * fixed namepaces * build script creates packages for all projects * updated docs to make sure no references to external repos that we will remove * +semver: breaking
This commit is contained in:
26
src/Ocelot.Provider.Consul/OcelotBuilderExtensions.cs
Normal file
26
src/Ocelot.Provider.Consul/OcelotBuilderExtensions.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
namespace Ocelot.Provider.Consul
|
||||
{
|
||||
using Configuration.Repository;
|
||||
using DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Middleware;
|
||||
using ServiceDiscovery;
|
||||
|
||||
public static class OcelotBuilderExtensions
|
||||
{
|
||||
public static IOcelotBuilder AddConsul(this IOcelotBuilder builder)
|
||||
{
|
||||
builder.Services.AddSingleton<ServiceDiscoveryFinderDelegate>(ConsulProviderFactory.Get);
|
||||
builder.Services.AddSingleton<IConsulClientFactory, ConsulClientFactory>();
|
||||
return builder;
|
||||
}
|
||||
|
||||
public static IOcelotBuilder AddConfigStoredInConsul(this IOcelotBuilder builder)
|
||||
{
|
||||
builder.Services.AddSingleton<OcelotMiddlewareConfigurationDelegate>(ConsulMiddlewareConfigurationProvider.Get);
|
||||
builder.Services.AddHostedService<FileConfigurationPoller>();
|
||||
builder.Services.AddSingleton<IFileConfigurationRepository, ConsulFileConfigurationRepository>();
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user