15 changed files with 296 additions and 94 deletions
@ -1,31 +0,0 @@ |
|||||
using Microsoft.AspNetCore.Builder; |
|
||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
using System.IO; |
|
||||
using Volo.Abp.IO; |
|
||||
using Volo.Abp.Modularity.PlugIns; |
|
||||
|
|
||||
namespace LINGYUN.MicroService.Internal.ApiGateway |
|
||||
{ |
|
||||
public class Startup |
|
||||
{ |
|
||||
public void ConfigureServices(IServiceCollection services) |
|
||||
{ |
|
||||
services.AddApplication<InternalApiGatewayModule>(options => |
|
||||
{ |
|
||||
// 搜索 Modules 目录下所有文件作为插件
|
|
||||
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
|
|
||||
var pluginFolder = Path.Combine( |
|
||||
Directory.GetCurrentDirectory(), "Modules"); |
|
||||
DirectoryHelper.CreateIfNotExists(pluginFolder); |
|
||||
options.PlugInSources.AddFolder( |
|
||||
pluginFolder, |
|
||||
SearchOption.AllDirectories); |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
public void Configure(IApplicationBuilder app) |
|
||||
{ |
|
||||
app.InitializeApplication(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,87 @@ |
|||||
|
{ |
||||
|
"Routes": [ |
||||
|
// 框架端点 |
||||
|
{ |
||||
|
"DownstreamPathTemplate": "/api/abp/application-configuration", |
||||
|
"DownstreamScheme": "http", |
||||
|
"DownstreamHostAndPorts": [ |
||||
|
{ |
||||
|
"Host": "127.0.0.1", |
||||
|
"Port": 30040 |
||||
|
} |
||||
|
], |
||||
|
"UpstreamPathTemplate": "/api/abp/task/application-configuration", |
||||
|
"UpstreamHttpMethod": [ "GET" ], |
||||
|
"LoadBalancerOptions": { |
||||
|
"Type": "RoundRobin" |
||||
|
}, |
||||
|
"RateLimitOptions": {}, |
||||
|
"QoSOptions": { |
||||
|
"ExceptionsAllowedBeforeBreaking": 10, |
||||
|
"DurationOfBreak": 1000, |
||||
|
"TimeoutValue": 10000 |
||||
|
}, |
||||
|
"HttpHandlerOptions": { |
||||
|
"UseTracing": true |
||||
|
}, |
||||
|
"Key": "task-configuration" |
||||
|
}, |
||||
|
// 框架动态API端点 |
||||
|
{ |
||||
|
"DownstreamPathTemplate": "/api/abp/api-definition", |
||||
|
"DownstreamScheme": "http", |
||||
|
"DownstreamHostAndPorts": [ |
||||
|
{ |
||||
|
"Host": "127.0.0.1", |
||||
|
"Port": 30040 |
||||
|
} |
||||
|
], |
||||
|
"UpstreamPathTemplate": "/api/abp/task/api-definition", |
||||
|
"UpstreamHttpMethod": [ "GET" ], |
||||
|
"LoadBalancerOptions": { |
||||
|
"Type": "RoundRobin" |
||||
|
}, |
||||
|
"RateLimitOptions": {}, |
||||
|
"QoSOptions": { |
||||
|
"ExceptionsAllowedBeforeBreaking": 10, |
||||
|
"DurationOfBreak": 1000, |
||||
|
"TimeoutValue": 10000 |
||||
|
}, |
||||
|
"HttpHandlerOptions": { |
||||
|
"UseTracing": true |
||||
|
}, |
||||
|
"Key": "task-api-definition" |
||||
|
}, |
||||
|
// 任务管理 |
||||
|
{ |
||||
|
"DownstreamPathTemplate": "/api/task-management/{everything}", |
||||
|
"DownstreamScheme": "http", |
||||
|
"DownstreamHostAndPorts": [ |
||||
|
{ |
||||
|
"Host": "127.0.0.1", |
||||
|
"Port": 30040 |
||||
|
} |
||||
|
], |
||||
|
"UpstreamPathTemplate": "/api/task-management/{everything}", |
||||
|
"UpstreamHttpMethod": [ "GET", "POST", "PUT", "DELETE" ], |
||||
|
"LoadBalancerOptions": { |
||||
|
"Type": "RoundRobin" |
||||
|
}, |
||||
|
"RateLimitOptions": { |
||||
|
"ClientWhitelist": [], |
||||
|
"EnableRateLimiting": true, |
||||
|
"Period": "1s", |
||||
|
"PeriodTimespan": 1, |
||||
|
"Limit": 5 |
||||
|
}, |
||||
|
"QoSOptions": { |
||||
|
"ExceptionsAllowedBeforeBreaking": 10, |
||||
|
"DurationOfBreak": 1000, |
||||
|
"TimeoutValue": 10000 |
||||
|
}, |
||||
|
"HttpHandlerOptions": { |
||||
|
"UseTracing": true |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
} |
||||
Loading…
Reference in new issue