mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-17 23:43:22 +08:00
moved create admin area call
This commit is contained in:
parent
ef3deec8da
commit
1e88062ce2
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user