mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 20:30:50 +08:00 
			
		
		
		
	changed file config stuff to just use app base directory
This commit is contained in:
		@@ -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>();
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user