Browse Source

Merge pull request #902 from colinin/remote-ocelot-config-file-watch

feat(gateway): remove ocelot config files listening.
pull/914/head
yx lin 2 years ago
committed by GitHub
parent
commit
1a1a3c5a03
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      gateways/Directory.Build.props
  2. 2
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/LINGYUN.MicroService.Internal.ApiGateway.csproj
  3. 83
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Ocelot/Configuration/AutoConfigOcelot.cs
  4. 116
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Ocelot/Configuration/Repository/DiskFileConfigurationAggragatorRepository.cs
  5. 2
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Ocelot/Multiplexer/AbpResponseMergeAggregator.cs
  6. 62
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.aggregate.json
  7. 809
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.backendadmin.json
  8. 24
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.global.json
  9. 255
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.idsadmin.json
  10. 129
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.localization.json
  11. 291
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.messages.json
  12. 303
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.platform.json
  13. 96
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.task.json
  14. 62
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.webhook.json
  15. 11
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Program.cs

1
gateways/Directory.Build.props

@ -10,6 +10,7 @@
<HangfireMySqlStoragePackageVersion>2.0.3</HangfireMySqlStoragePackageVersion>
<HangfireMSSQLStoragePackageVersion>1.8.2</HangfireMSSQLStoragePackageVersion>
<NESTPackageVersion>7.15.1</NESTPackageVersion>
<OcelotProviderPollyPackageVersion>20.0.0</OcelotProviderPollyPackageVersion>
<StackExchangeRedisPackageVersion>2.0.593</StackExchangeRedisPackageVersion>
<SerilogPackageVersion>2.10.0</SerilogPackageVersion>
<SerilogAspNetCorePackageVersion>4.1.0</SerilogAspNetCorePackageVersion>

2
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/LINGYUN.MicroService.Internal.ApiGateway.csproj

@ -9,7 +9,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Ocelot.Provider.Polly" Version="16.0.1" />
<PackageReference Include="Ocelot.Provider.Polly" Version="$(OcelotProviderPollyPackageVersion)" />
<PackageReference Include="AgileConfig.Client" Version="$(AgileConfigClientPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="Serilog.AspNetCore" Version="$(SerilogAspNetCorePackageVersion)" />

83
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Ocelot/Configuration/AutoConfigOcelot.cs

@ -1,83 +0,0 @@

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using Castle.Core.Logging;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Memory;
using Newtonsoft.Json;
using Ocelot.Configuration.File;
using Serilog;
using Serilog.Core;
namespace Ocelot.DependencyInjection
{
public static class ConfigurationBuilderExtensions
{
public static IConfigurationBuilder AddAutoOcelotConfig(this IConfigurationBuilder builder, IWebHostEnvironment env)
{
return builder.AddAutoOcelotConfig(".", env);
}
static object locker = new object();
public static IConfigurationBuilder AddAutoOcelotConfig(this IConfigurationBuilder builder, string folder, IWebHostEnvironment env)
{
WriteFile(folder, env);
Action<object, FileSystemEventArgs> fileChanged = (sender, e) =>
{
lock (locker)
{
Log.Debug("Ocelot config regenerate...");
Thread.Sleep(100); //解决vs文件保存时多次触发change事件时引起异常
WriteFile(folder, env);
}
};
FileSystemWatcher watcher = new FileSystemWatcher("OcelotConfig", "*.json");
watcher.Changed += new FileSystemEventHandler(fileChanged);
watcher.Deleted += new FileSystemEventHandler(fileChanged);
watcher.Created += new FileSystemEventHandler(fileChanged);
watcher.Renamed += new RenamedEventHandler(fileChanged);
watcher.EnableRaisingEvents = true;
builder.AddJsonFile("ocelot.json", optional: true, reloadOnChange: true);
return builder;
}
private static void WriteFile(string folder, IWebHostEnvironment env)
{
string excludeConfigName = ((env != null && env.EnvironmentName != null) ? ("ocelot." + env.EnvironmentName + ".json") : string.Empty);
Regex reg = new Regex("^ocelot\\.(.*?)\\.json$", RegexOptions.IgnoreCase | RegexOptions.Singleline);
List<FileInfo> list = (from fi in new DirectoryInfo(folder).EnumerateFiles()
where reg.IsMatch(fi.Name) && fi.Name != excludeConfigName
select fi).ToList();
FileConfiguration fileConfiguration = new FileConfiguration();
foreach (FileInfo item in list)
{
if (list.Count <= 1 || !item.Name.Equals("ocelot.json", StringComparison.OrdinalIgnoreCase))
{
FileConfiguration fileConfiguration2 = JsonConvert.DeserializeObject<FileConfiguration>(File.ReadAllText(item.FullName));
if (fileConfiguration2 == null)
{
Log.Fatal($"Ocelot config file \"{item.FullName}\" is empty");
}
if (item.Name.Equals("ocelot.global.json", StringComparison.OrdinalIgnoreCase))
{
fileConfiguration.GlobalConfiguration = fileConfiguration2.GlobalConfiguration;
}
fileConfiguration.Aggregates.AddRange(fileConfiguration2.Aggregates);
fileConfiguration.Routes.AddRange(fileConfiguration2.Routes);
}
}
string contents = JsonConvert.SerializeObject(fileConfiguration, Formatting.Indented);
File.WriteAllText("ocelot.json", contents);
}
}
}

116
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Ocelot/Configuration/Repository/DiskFileConfigurationAggragatorRepository.cs

@ -1,116 +0,0 @@
using Microsoft.AspNetCore.Hosting;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Nito.AsyncEx;
using Ocelot.Configuration.ChangeTracking;
using Ocelot.Configuration.File;
using Ocelot.Configuration.Repository;
using Ocelot.Responses;
using System.IO;
using System.Threading.Tasks;
using Volo.Abp.IO;
namespace LINGYUN.MicroService.Internal.ApiGateway.Ocelot.Configuration.Repository
{
public class DiskFileConfigurationAggragatorRepository : IFileConfigurationRepository
{
private readonly IWebHostEnvironment _hostEnvironment;
private readonly IOcelotConfigurationChangeTokenSource _changeTokenSource;
private readonly string[] _ocelotFiles;
private static readonly AsyncLock _lock = new AsyncLock();
private readonly string _ocelotFilePath;
private readonly string _environmentFilePath;
public DiskFileConfigurationAggragatorRepository(
IWebHostEnvironment hostingEnvironment,
IOcelotConfigurationChangeTokenSource changeTokenSource)
{
_changeTokenSource = changeTokenSource;
_hostEnvironment = hostingEnvironment;
_ocelotFilePath = Path.Combine(_hostEnvironment.ContentRootPath, "ocelot.json");
_environmentFilePath = Path.Combine(
_hostEnvironment.ContentRootPath,
$"ocelot.{hostingEnvironment.EnvironmentName ?? "Development"}.json");
_ocelotFiles = new string[9]
{
"ocelot.global.json",
"ocelot.backendadmin.json",
"ocelot.idsadmin.json",
"ocelot.localization.json",
"ocelot.messages.json",
"ocelot.platform.json",
"ocelot.aggregate.json",
"ocelot.task.json",
"ocelot.webhook.json"
};
}
public async Task<Response<FileConfiguration>> Get()
{
JObject configObject = null;
JsonMergeSettings mergeSetting = new()
{
MergeArrayHandling = MergeArrayHandling.Union,
PropertyNameComparison = System.StringComparison.CurrentCultureIgnoreCase
};
using (await _lock.LockAsync())
{
if (File.Exists(_environmentFilePath))
{
var configValue = await FileHelper.ReadAllTextAsync(_environmentFilePath);
configObject = JObject.Parse(configValue);
}
else
{
foreach (var ocelotFile in _ocelotFiles)
{
var configValue = await FileHelper.ReadAllTextAsync(
Path.Combine(_hostEnvironment.ContentRootPath, ocelotFile));
if (configObject == null)
{
configObject = JObject.Parse(configValue);
}
else
{
configObject.Merge(JObject.Parse(configValue), mergeSetting);
}
}
await File.WriteAllTextAsync(_environmentFilePath, configObject.ToString(), encoding: System.Text.Encoding.UTF8);
}
var aggregatorConfig = configObject.ToObject<FileConfiguration>();
return new OkResponse<FileConfiguration>(aggregatorConfig);
}
}
public Task<Response> Set(FileConfiguration fileConfiguration)
{
string contents = JsonConvert.SerializeObject(fileConfiguration, Formatting.Indented);
lock (_lock)
{
if (System.IO.File.Exists(_environmentFilePath))
{
System.IO.File.Delete(_environmentFilePath);
}
System.IO.File.WriteAllText(_environmentFilePath, contents);
if (System.IO.File.Exists(_ocelotFilePath))
{
System.IO.File.Delete(_ocelotFilePath);
}
System.IO.File.WriteAllText(_ocelotFilePath, contents);
}
_changeTokenSource.Activate();
return Task.FromResult((Response)new OkResponse());
}
}
}

2
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Ocelot/Multiplexer/AbpResponseMergeAggregator.cs

@ -93,7 +93,7 @@ namespace Ocelot.Multiplexer
}
catch (System.Exception ex)
{
Logger.LogError(content);
Logger.LogError(ex, "An error occurred in the aggregate route request result.");
return new DownstreamResponse(
null,
HttpStatusCode.InternalServerError,

62
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.aggregate.json

@ -1,62 +0,0 @@
{
"Aggregates": [
{
"RouteKeys": [
"platform-api-definition",
"backend-admin-api-definition",
"messages-api-definition",
"ids-admin-api-definition",
"localization-api-definition",
"task-api-definition",
"webhook-api-definition"
],
"UpstreamPathTemplate": "/api/abp/api-definition",
"Aggregator": "AbpResponseMergeAggregator"
},
{
"RouteKeys": [
"platform-configuration",
"backend-admin-configuration",
"messages-configuration",
"ids-admin-configuration",
"localization-configuration",
"task-configuration"
],
"UpstreamPathTemplate": "/api/abp/application-configuration",
"Aggregator": "AbpResponseMergeAggregator",
"Priority": 99
},
{
"RouteKeys": [
"setting-global",
"wechat-setting-global",
"tencent-cloud-setting-global",
"aliyun-setting-global",
"oss-management-setting-global"
],
"UpstreamPathTemplate": "/api/setting-management/settings/by-global",
"Aggregator": "AbpResponseMergeAggregator",
"Priority": 99
},
{
"RouteKeys": [
"setting-current-tenant",
"wechat-setting-current-tenant",
"tencent-cloud-setting-current-tenant",
"aliyun-setting-current-tenant",
"oss-management-setting-current-tenant"
],
"UpstreamPathTemplate": "/api/setting-management/settings/by-current-tenant",
"Aggregator": "AbpResponseMergeAggregator",
"Priority": 99
},
{
"RouteKeys": [
"setting-current-user"
],
"UpstreamPathTemplate": "/api/setting-management/settings/by-current-user",
"Aggregator": "AbpResponseMergeAggregator",
"Priority": 99
}
]
}

809
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.backendadmin.json

@ -1,809 +0,0 @@
{
"Routes": [
{
"DownstreamPathTemplate": "/api/abp/application-configuration",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/abp/backend-admin/application-configuration",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "backend-admin-configuration"
},
{
"DownstreamPathTemplate": "/api/abp/api-definition",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/abp/backend-admin/api-definition",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "backend-admin-api-definition"
},
{
"DownstreamPathTemplate": "/api/abp/multi-tenancy/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/abp/multi-tenancy/{everything}",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/api/tenant-management/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/tenant-management/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/api/permission-management/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/permission-management/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/api/setting-management/settings/by-current-tenant",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/setting-management/settings/by-current-tenant/app",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "setting-current-tenant"
},
{
"DownstreamPathTemplate": "/api/setting-management/settings/by-current-user",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/setting-management/settings/by-current-user/app",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "setting-current-user"
},
{
"DownstreamPathTemplate": "/api/setting-management/settings/by-global",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/setting-management/settings/by-global/app",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "setting-global"
},
{
"DownstreamPathTemplate": "/api/setting-management/wechat/by-current-tenant",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/setting-management/wechat/by-current-tenant",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "wechat-setting-current-tenant"
},
{
"DownstreamPathTemplate": "/api/setting-management/wechat/by-global",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/setting-management/wechat/by-global",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "wechat-setting-global"
},
{
"DownstreamPathTemplate": "/api/setting-management/tencent-cloud/by-current-tenant",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/setting-management/tencent-cloud/by-current-tenant",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "tencent-cloud-setting-current-tenant"
},
{
"DownstreamPathTemplate": "/api/setting-management/tencent-cloud/by-global",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/setting-management/tencent-cloud/by-global",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "tencent-cloud-setting-global"
},
{
"DownstreamPathTemplate": "/api/setting-management/aliyun/by-current-tenant",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/setting-management/aliyun/by-current-tenant",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "aliyun-setting-current-tenant"
},
{
"DownstreamPathTemplate": "/api/setting-management/aliyun/by-global",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/setting-management/aliyun/by-global",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "aliyun-setting-global"
},
{
"DownstreamPathTemplate": "/api/setting-management/settings/change-global",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/setting-management/settings/change-global",
"UpstreamHttpMethod": [
"PUT"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/api/setting-management/settings/change-current-tenant",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/setting-management/settings/change-current-tenant",
"UpstreamHttpMethod": [
"PUT"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/api/setting-management/settings/change-current-user",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/setting-management/settings/change-current-user",
"UpstreamHttpMethod": [
"PUT"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/api/setting-management/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/setting-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
}
},
{
"DownstreamPathTemplate": "/api/feature-management/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/feature-management/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/api/saas/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/saas/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/api/auditing/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/auditing/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/api/text-templating/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/text-templating/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 30000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/api/caching-management/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/caching-management/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 30000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/api/abp/localization/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/abp/localization/{everything}",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/swagger/v1/swagger.json",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30010
}
],
"UpstreamPathTemplate": "/admin/v1/swagger.json",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
}
]
}

24
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.global.json

@ -1,24 +0,0 @@
{
"GlobalConfiguration": {
"BaseUrl": "http://localhost:30000",
"DownstreamScheme": "HTTP",
"HttpHandlerOptions": {
"UseTracing": true
},
"RateLimitOptions": {
"DisableRateLimitHeaders": false,
"ClientIdHeader": "ClientId",
"RateLimitCounterPrefix": "ocelot",
"QuotaExceededMessage": "您的操作过快,请稍后再试!",
"HttpStatusCode": 429
},
"QoSOptions": {
"TimeoutValue": 30000,
"DurationOfBreak": 60000,
"ExceptionsAllowedBeforeBreaking": 30
},
"LoadBalancerOptions": {
"Type": "RoundRobin"
}
}
}

255
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.idsadmin.json

@ -1,255 +0,0 @@
{
"Routes": [
//
{
"DownstreamPathTemplate": "/api/abp/application-configuration",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30015
}
],
"UpstreamPathTemplate": "/api/abp/ids-admin/application-configuration",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "ids-admin-configuration"
},
// API
{
"DownstreamPathTemplate": "/api/abp/api-definition",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30015
}
],
"UpstreamPathTemplate": "/api/abp/ids-admin/api-definition",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "ids-admin-api-definition"
},
//
{
"DownstreamPathTemplate": "/api/identity/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30015
}
],
"UpstreamPathTemplate": "/api/identity/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
//
{
"DownstreamPathTemplate": "/api/identity-server/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30015
}
],
"UpstreamPathTemplate": "/api/identity-server/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
//
{
"DownstreamPathTemplate": "/api/account/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30015
}
],
"UpstreamPathTemplate": "/api/account/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
//
{
"DownstreamPathTemplate": "/.well-known/openid-configuration",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 44385
}
],
"UpstreamPathTemplate": "/.well-known/openid-configuration",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/connect/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 44385
}
],
"UpstreamPathTemplate": "/connect/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
// API
{
"DownstreamPathTemplate": "/swagger/v1/swagger.json",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30015
}
],
"UpstreamPathTemplate": "/ids-admin/v1/swagger.json",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
}
]
}

129
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.localization.json

@ -1,129 +0,0 @@
{
"Routes": [
//
{
"DownstreamPathTemplate": "/api/abp/application-configuration",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30030
}
],
"UpstreamPathTemplate": "/api/abp/localization/application-configuration",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "localization-configuration"
},
// API
{
"DownstreamPathTemplate": "/api/abp/api-definition",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30030
}
],
"UpstreamPathTemplate": "/api/abp/localization/api-definition",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "localization-api-definition"
},
//
{
"DownstreamPathTemplate": "/api/localization/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30030
}
],
"UpstreamPathTemplate": "/api/localization/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
// API
{
"DownstreamPathTemplate": "/swagger/v1/swagger.json",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30030
}
],
"UpstreamPathTemplate": "/localization/v1/swagger.json",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
}
]
}

291
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.messages.json

@ -1,291 +0,0 @@
{
"Routes": [
//
{
"DownstreamPathTemplate": "/api/abp/application-configuration",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30020
}
],
"UpstreamPathTemplate": "/api/abp/messages/application-configuration",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "messages-configuration"
},
// API
{
"DownstreamPathTemplate": "/api/abp/api-definition",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30020
}
],
"UpstreamPathTemplate": "/api/abp/messages/api-definition",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "messages-api-definition"
},
//
{
"DownstreamPathTemplate": "/api/im/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30020
}
],
"UpstreamPathTemplate": "/api/im/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
// Hangfire
{
"DownstreamPathTemplate": "/hangfire/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30020
}
],
"UpstreamPathTemplate": "/hangfire/{everything}",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
//
{
"DownstreamPathTemplate": "/api/notifications/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30020
}
],
"UpstreamPathTemplate": "/api/notifications/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
// Api
{
"DownstreamPathTemplate": "/swagger/v1/swagger.json",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30020
}
],
"UpstreamPathTemplate": "/messages/v1/swagger.json",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
// signalr
{
"DownstreamPathTemplate": "/signalr-hubs/messages",
"DownstreamScheme": "ws",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30020
}
],
"UpstreamPathTemplate": "/signalr-hubs/messages",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE",
"OPTIONS"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {},
"DangerousAcceptAnyServerCertificateValidator": true,
"RouteIsCaseSensitive": false,
"Priority": 99
},
{
"DownstreamPathTemplate": "/signalr-hubs/notifications",
"DownstreamScheme": "ws",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30020
}
],
"UpstreamPathTemplate": "/signalr-hubs/notifications",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE",
"OPTIONS"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {},
"DangerousAcceptAnyServerCertificateValidator": true,
"RouteIsCaseSensitive": false,
"Priority": 99
},
{
"DownstreamPathTemplate": "/signalr-hubs/{everything}",
"DownstreamScheme": "ws",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30020
}
],
"UpstreamPathTemplate": "/signalr-hubs/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE",
"OPTIONS"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {},
"DangerousAcceptAnyServerCertificateValidator": true,
"RouteIsCaseSensitive": false
}
]
}

303
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.platform.json

@ -1,303 +0,0 @@
{
"Routes": [
//
{
"DownstreamPathTemplate": "/api/abp/application-configuration",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30025
}
],
"UpstreamPathTemplate": "/api/abp/platform/application-configuration",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "platform-configuration"
},
// API
{
"DownstreamPathTemplate": "/api/abp/api-definition",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30025
}
],
"UpstreamPathTemplate": "/api/abp/platform/api-definition",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "platform-api-definition"
},
// oss
{
"DownstreamPathTemplate": "/api/oss-management/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30025
}
],
"UpstreamPathTemplate": "/api/oss-management/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
//
{
"DownstreamPathTemplate": "/api/platform/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30025
}
],
"UpstreamPathTemplate": "/api/platform/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
//
{
"DownstreamPathTemplate": "/api/files/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30025
}
],
"UpstreamPathTemplate": "/api/files/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/api/files/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30025
}
],
"UpstreamPathTemplate": "/api/api/files/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
// oss
{
"DownstreamPathTemplate": "/api/setting-management/oss-management/by-current-tenant",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30025
}
],
"UpstreamPathTemplate": "/api/setting-management/oss-management/by-current-tenant",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "oss-management-setting-current-tenant"
},
{
"DownstreamPathTemplate": "/api/setting-management/oss-management/by-global",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30025
}
],
"UpstreamPathTemplate": "/api/setting-management/oss-management/by-global",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "oss-management-setting-global"
},
// Api
{
"DownstreamPathTemplate": "/swagger/v1/swagger.json",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30025
}
],
"UpstreamPathTemplate": "/platform/v1/swagger.json",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
}
]
}

96
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.task.json

@ -1,96 +0,0 @@
{
"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": 100
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
}
]
}

62
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.webhook.json

@ -1,62 +0,0 @@
{
"Routes": [
// API
{
"DownstreamPathTemplate": "/api/abp/api-definition",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30045
}
],
"UpstreamPathTemplate": "/api/abp/webhook/api-definition",
"UpstreamHttpMethod": [
"GET"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Key": "webhook-api-definition"
},
// webhooks
{
"DownstreamPathTemplate": "/api/webhooks/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30045
}
],
"UpstreamPathTemplate": "/api/webhooks/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 30000
},
"HttpHandlerOptions": {
"UseTracing": true
}
}
]
}

11
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Program.cs

@ -1,9 +1,7 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Ocelot.DependencyInjection;
using Serilog;
using System;
using System.IO;
@ -27,20 +25,13 @@ public class Program
.UseAutofac()
.ConfigureAppConfiguration((context, config) =>
{
//// 加入 ocelot配置文件
//config.AddJsonFile(
//$"ocelot.{context.HostingEnvironment.EnvironmentName ?? "Development"}.json",
//optional: true,
//reloadOnChange: true);
config.AddAutoOcelotConfig("OcelotConfig", builder.Environment);
var configuration = config.Build();
var agileConfigEnabled = configuration["AgileConfig:IsEnabled"];
if (agileConfigEnabled.IsNullOrEmpty() || bool.Parse(agileConfigEnabled))
{
config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration));
}
})
.UseSerilog((context, provider, config) =>
{

Loading…
Cancel
Save