Feature/store configuraton json idented (#328)

* messing around with benchmark.net.seems Ocelot adds about 2ms to a request..lets make this less? :)

* #326 store json indented so it looks nice :P
This commit is contained in:
Tom Pallister
2018-04-24 08:30:17 +01:00
committed by GitHub
parent 636d116491
commit 77211e9f16
14 changed files with 445 additions and 53 deletions

View File

@ -13,7 +13,7 @@ namespace Ocelot.Configuration.Repository
public class ConsulFileConfigurationRepository : IFileConfigurationRepository
{
private readonly ConsulClient _consul;
private readonly IConsulClient _consul;
private const string OcelotConfiguration = "InternalConfiguration";
private readonly Cache.IOcelotCache<FileConfiguration> _cache;
private readonly IOcelotLogger _logger;
@ -72,7 +72,7 @@ namespace Ocelot.Configuration.Repository
public async Task<Response> Set(FileConfiguration ocelotConfiguration)
{
var json = JsonConvert.SerializeObject(ocelotConfiguration);
var json = JsonConvert.SerializeObject(ocelotConfiguration, Formatting.Indented);
var bytes = Encoding.UTF8.GetBytes(json);

View File

@ -36,7 +36,7 @@ namespace Ocelot.Configuration.Repository
public Task<Response> Set(FileConfiguration fileConfiguration)
{
string jsonConfiguration = JsonConvert.SerializeObject(fileConfiguration);
string jsonConfiguration = JsonConvert.SerializeObject(fileConfiguration, Formatting.Indented);
lock(_lock)
{

View File

@ -6,7 +6,7 @@ namespace Ocelot.Infrastructure.Consul
{
public class ConsulClientFactory : IConsulClientFactory
{
public ConsulClient Get(ConsulRegistryConfiguration config)
public IConsulClient Get(ConsulRegistryConfiguration config)
{
return new ConsulClient(c =>
{

View File

@ -5,6 +5,6 @@ namespace Ocelot.Infrastructure.Consul
{
public interface IConsulClientFactory
{
ConsulClient Get(ConsulRegistryConfiguration config);
IConsulClient Get(ConsulRegistryConfiguration config);
}
}

View File

@ -15,7 +15,7 @@ namespace Ocelot.ServiceDiscovery.Providers
{
private readonly ConsulRegistryConfiguration _config;
private readonly IOcelotLogger _logger;
private readonly ConsulClient _consul;
private readonly IConsulClient _consul;
private const string VersionPrefix = "version-";
public ConsulServiceDiscoveryProvider(ConsulRegistryConfiguration config, IOcelotLoggerFactory factory, IConsulClientFactory clientFactory)