mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 11:18:16 +08:00

* hacked together load balancing reroutes in fileconfig * some renaming and refactoring * more renames * hacked away the old config json * test for issue 213 * renamed key * dont share ports * oops * updated docs * mvoed docs around * port being used
32 lines
911 B
C#
32 lines
911 B
C#
using System.Threading.Tasks;
|
|
using Ocelot.Configuration.File;
|
|
using Ocelot.Configuration.Repository;
|
|
using Ocelot.Responses;
|
|
|
|
namespace Ocelot.Configuration.Provider
|
|
{
|
|
/// <summary>
|
|
/// Register as singleton
|
|
/// </summary>
|
|
public class OcelotConfigurationProvider : IOcelotConfigurationProvider
|
|
{
|
|
private readonly IOcelotConfigurationRepository _config;
|
|
|
|
public OcelotConfigurationProvider(IOcelotConfigurationRepository repo)
|
|
{
|
|
_config = repo;
|
|
}
|
|
|
|
public async Task<Response<IOcelotConfiguration>> Get()
|
|
{
|
|
var repoConfig = await _config.Get();
|
|
|
|
if (repoConfig.IsError)
|
|
{
|
|
return new ErrorResponse<IOcelotConfiguration>(repoConfig.Errors);
|
|
}
|
|
|
|
return new OkResponse<IOcelotConfiguration>(repoConfig.Data);
|
|
}
|
|
}
|
|
} |