Files
Ocelot/src/Ocelot/Configuration/Provider/OcelotConfigurationProvider.cs
Tom Pallister 3ac9b3bd87 hacked together load balancing reroutes in fileconfig (#211)
* 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
2018-01-31 20:34:55 +00:00

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);
}
}
}