From de5b940d5901968559db82938ad86b4f5eb401cd Mon Sep 17 00:00:00 2001 From: colin Date: Sat, 4 Nov 2023 10:33:16 +0800 Subject: [PATCH] feat(gateway): remove ocelot config files listening. --- gateways/Directory.Build.props | 1 + ...UN.MicroService.Internal.ApiGateway.csproj | 2 +- .../Ocelot/Configuration/AutoConfigOcelot.cs | 83 -- ...skFileConfigurationAggragatorRepository.cs | 116 --- .../Multiplexer/AbpResponseMergeAggregator.cs | 2 +- .../OcelotConfig/ocelot.aggregate.json | 62 -- .../OcelotConfig/ocelot.backendadmin.json | 809 ------------------ .../OcelotConfig/ocelot.global.json | 24 - .../OcelotConfig/ocelot.idsadmin.json | 255 ------ .../OcelotConfig/ocelot.localization.json | 129 --- .../OcelotConfig/ocelot.messages.json | 291 ------- .../OcelotConfig/ocelot.platform.json | 303 ------- .../OcelotConfig/ocelot.task.json | 96 --- .../OcelotConfig/ocelot.webhook.json | 62 -- .../Program.cs | 11 +- 15 files changed, 4 insertions(+), 2242 deletions(-) delete mode 100644 gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Ocelot/Configuration/AutoConfigOcelot.cs delete mode 100644 gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Ocelot/Configuration/Repository/DiskFileConfigurationAggragatorRepository.cs delete mode 100644 gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.aggregate.json delete mode 100644 gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.backendadmin.json delete mode 100644 gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.global.json delete mode 100644 gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.idsadmin.json delete mode 100644 gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.localization.json delete mode 100644 gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.messages.json delete mode 100644 gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.platform.json delete mode 100644 gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.task.json delete mode 100644 gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.webhook.json diff --git a/gateways/Directory.Build.props b/gateways/Directory.Build.props index b4f4bce0f..52f72ce66 100644 --- a/gateways/Directory.Build.props +++ b/gateways/Directory.Build.props @@ -10,6 +10,7 @@ 2.0.3 1.8.2 7.15.1 + 20.0.0 2.0.593 2.10.0 4.1.0 diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/LINGYUN.MicroService.Internal.ApiGateway.csproj b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/LINGYUN.MicroService.Internal.ApiGateway.csproj index b21c69b87..428381085 100644 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/LINGYUN.MicroService.Internal.ApiGateway.csproj +++ b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/LINGYUN.MicroService.Internal.ApiGateway.csproj @@ -9,7 +9,7 @@ - + diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Ocelot/Configuration/AutoConfigOcelot.cs b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Ocelot/Configuration/AutoConfigOcelot.cs deleted file mode 100644 index f8517ca01..000000000 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Ocelot/Configuration/AutoConfigOcelot.cs +++ /dev/null @@ -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 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 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(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); - } - } -} \ No newline at end of file diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Ocelot/Configuration/Repository/DiskFileConfigurationAggragatorRepository.cs b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Ocelot/Configuration/Repository/DiskFileConfigurationAggragatorRepository.cs deleted file mode 100644 index b83e3ecdb..000000000 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Ocelot/Configuration/Repository/DiskFileConfigurationAggragatorRepository.cs +++ /dev/null @@ -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> 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(); - - return new OkResponse(aggregatorConfig); - } - } - - public Task 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()); - } - } -} diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Ocelot/Multiplexer/AbpResponseMergeAggregator.cs b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Ocelot/Multiplexer/AbpResponseMergeAggregator.cs index 49e6abaf2..336e56fde 100644 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Ocelot/Multiplexer/AbpResponseMergeAggregator.cs +++ b/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, diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.aggregate.json b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.aggregate.json deleted file mode 100644 index de5c3484d..000000000 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.aggregate.json +++ /dev/null @@ -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 - } - ] -} diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.backendadmin.json b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.backendadmin.json deleted file mode 100644 index d82cfdfdf..000000000 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.backendadmin.json +++ /dev/null @@ -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 - } - } - ] -} diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.global.json b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.global.json deleted file mode 100644 index a6439b946..000000000 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.global.json +++ /dev/null @@ -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" - } - } -} diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.idsadmin.json b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.idsadmin.json deleted file mode 100644 index 573860869..000000000 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.idsadmin.json +++ /dev/null @@ -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 - } - } - ] -} \ No newline at end of file diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.localization.json b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.localization.json deleted file mode 100644 index c6cbe9bfb..000000000 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.localization.json +++ /dev/null @@ -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 - } - } - ] -} \ No newline at end of file diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.messages.json b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.messages.json deleted file mode 100644 index 8fab8d957..000000000 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.messages.json +++ /dev/null @@ -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 - } - ] -} \ No newline at end of file diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.platform.json b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.platform.json deleted file mode 100644 index bf040d8c9..000000000 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.platform.json +++ /dev/null @@ -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 - } - } - ] -} \ No newline at end of file diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.task.json b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.task.json deleted file mode 100644 index 7fa47381c..000000000 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.task.json +++ /dev/null @@ -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 - } - } - ] -} \ No newline at end of file diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.webhook.json b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.webhook.json deleted file mode 100644 index b1394a7e7..000000000 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/OcelotConfig/ocelot.webhook.json +++ /dev/null @@ -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 - } - } - ] -} \ No newline at end of file diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Program.cs b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Program.cs index 585be4326..286bb3dd1 100644 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/Program.cs +++ b/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) => {