mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 00:38:16 +08:00
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:
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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 =>
|
||||
{
|
||||
|
@ -5,6 +5,6 @@ namespace Ocelot.Infrastructure.Consul
|
||||
{
|
||||
public interface IConsulClientFactory
|
||||
{
|
||||
ConsulClient Get(ConsulRegistryConfiguration config);
|
||||
IConsulClient Get(ConsulRegistryConfiguration config);
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user