mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 15:30:49 +08:00 
			
		
		
		
	moved create admin area call
This commit is contained in:
		@@ -31,26 +31,11 @@ namespace Ocelot.Middleware
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public static async Task<IApplicationBuilder> UseOcelot(this IApplicationBuilder builder)
 | 
			
		||||
        {
 | 
			
		||||
            await CreateAdministrationArea(builder);
 | 
			
		||||
 | 
			
		||||
            await builder.UseOcelot(new OcelotMiddlewareConfiguration());
 | 
			
		||||
 | 
			
		||||
            return builder;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static async Task CreateAdministrationArea(IApplicationBuilder builder)
 | 
			
		||||
        {
 | 
			
		||||
            var configuration = await CreateConfiguration(builder);
 | 
			
		||||
 | 
			
		||||
            if(!string.IsNullOrEmpty(configuration.AdministrationPath))
 | 
			
		||||
            {
 | 
			
		||||
                builder.Map(configuration.AdministrationPath, x => 
 | 
			
		||||
                {
 | 
			
		||||
                    x.UseMvc();
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Registers Ocelot with a combination of default middlewares and optional middlewares in the configuration
 | 
			
		||||
        /// </summary>
 | 
			
		||||
@@ -153,6 +138,19 @@ namespace Ocelot.Middleware
 | 
			
		||||
            return config.Data;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static async Task CreateAdministrationArea(IApplicationBuilder builder)
 | 
			
		||||
        {
 | 
			
		||||
            var configuration = await CreateConfiguration(builder);
 | 
			
		||||
 | 
			
		||||
            if(!string.IsNullOrEmpty(configuration.AdministrationPath))
 | 
			
		||||
            {
 | 
			
		||||
                builder.Map(configuration.AdministrationPath, x => 
 | 
			
		||||
                {
 | 
			
		||||
                    x.UseMvc();
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static void UseIfNotNull(this IApplicationBuilder builder, Func<HttpContext, Func<Task>, Task> middleware)
 | 
			
		||||
        {
 | 
			
		||||
            if (middleware != null)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user