changed file config stuff to just use app base directory

This commit is contained in:
TomPallister
2017-02-19 12:58:22 +00:00
parent 816221c7a6
commit fa47663259
6 changed files with 26 additions and 59 deletions

View File

@ -31,6 +31,7 @@ using Ocelot.Requester;
using Ocelot.Requester.QoS;
using Ocelot.Responder;
using Ocelot.ServiceDiscovery;
using Ocelot.Services;
namespace Ocelot.DependencyInjection
{
@ -62,6 +63,7 @@ namespace Ocelot.DependencyInjection
{
services.AddMvcCore().AddJsonFormatters();
services.AddLogging();
services.AddSingleton<IGetFileConfiguration, GetFileConfiguration>();
services.AddSingleton<IQosProviderHouse, QosProviderHouse>();
services.AddSingleton<IQoSProviderFactory, QoSProviderFactory>();
services.AddSingleton<IServiceDiscoveryProviderFactory, ServiceDiscoveryProviderFactory>();

View File

@ -10,7 +10,7 @@ namespace Ocelot.Services
{
public Response<FileConfiguration> Invoke()
{
var configFilePath = "configuration.json";
var configFilePath = $"{AppContext.BaseDirectory}/configuration.json";
var json = File.ReadAllText(configFilePath);
var fileConfiguration = JsonConvert.DeserializeObject<FileConfiguration>(json);
return new OkResponse<FileConfiguration>(fileConfiguration);