From 8aca99ab0d032835fa7a7d99368502abb29b4ac6 Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Sat, 11 Dec 2021 10:46:01 +0800 Subject: [PATCH] use appsettings(agile_config) as the main gateway configuration --- aspnet-core/Directory.Build.props | 2 +- aspnet-core/LINGYUN.MicroService.All.sln | 7 +++++++ .../LINGYUN/Abp/Wrapper/DefaultExceptionWrapHandler.cs | 3 +-- gateways/Directory.Build.props | 2 +- .../InternalApiGatewayModule.Configure.cs | 3 ++- .../InternalApiGatewayOptions.cs | 1 - .../appsettings.Development.json | 2 +- 7 files changed, 13 insertions(+), 7 deletions(-) diff --git a/aspnet-core/Directory.Build.props b/aspnet-core/Directory.Build.props index adfe8e5e3..3c4300a98 100644 --- a/aspnet-core/Directory.Build.props +++ b/aspnet-core/Directory.Build.props @@ -6,7 +6,7 @@ 5.2.0 1.5.10 2.13.0 - 1.2.1.3 + 1.2.1.5 2.0.3 1.7.27 7.15.1 diff --git a/aspnet-core/LINGYUN.MicroService.All.sln b/aspnet-core/LINGYUN.MicroService.All.sln index 12701821c..473f1f944 100644 --- a/aspnet-core/LINGYUN.MicroService.All.sln +++ b/aspnet-core/LINGYUN.MicroService.All.sln @@ -351,6 +351,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.OpenApi", "modu EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.OpenApi.Authorization", "modules\open-api\LINGYUN.Abp.OpenApi.Authorization\LINGYUN.Abp.OpenApi.Authorization.csproj", "{433AD1FB-2DE8-479F-B89E-A17217591538}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Wrapper", "modules\common\LINGYUN.Abp.Wrapper\LINGYUN.Abp.Wrapper.csproj", "{65311EC9-7A86-4E73-A587-F06A99474EDD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -909,6 +911,10 @@ Global {433AD1FB-2DE8-479F-B89E-A17217591538}.Debug|Any CPU.Build.0 = Debug|Any CPU {433AD1FB-2DE8-479F-B89E-A17217591538}.Release|Any CPU.ActiveCfg = Release|Any CPU {433AD1FB-2DE8-479F-B89E-A17217591538}.Release|Any CPU.Build.0 = Release|Any CPU + {65311EC9-7A86-4E73-A587-F06A99474EDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {65311EC9-7A86-4E73-A587-F06A99474EDD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {65311EC9-7A86-4E73-A587-F06A99474EDD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {65311EC9-7A86-4E73-A587-F06A99474EDD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1082,6 +1088,7 @@ Global {3C7A8246-DE82-4330-8697-24EF1B1C515D} = {C5CAD011-DF84-4914-939C-0C029DCEF26F} {4059F87E-9762-46C1-AEB1-B1128EA533AE} = {3C7A8246-DE82-4330-8697-24EF1B1C515D} {433AD1FB-2DE8-479F-B89E-A17217591538} = {3C7A8246-DE82-4330-8697-24EF1B1C515D} + {65311EC9-7A86-4E73-A587-F06A99474EDD} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Wrapper/LINGYUN/Abp/Wrapper/DefaultExceptionWrapHandler.cs b/aspnet-core/modules/common/LINGYUN.Abp.Wrapper/LINGYUN/Abp/Wrapper/DefaultExceptionWrapHandler.cs index b933eeeb4..83f4f02ba 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Wrapper/LINGYUN/Abp/Wrapper/DefaultExceptionWrapHandler.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Wrapper/LINGYUN/Abp/Wrapper/DefaultExceptionWrapHandler.cs @@ -30,10 +30,9 @@ namespace LINGYUN.Abp.Wrapper { if (context.StatusCode.HasValue) { - context.WithCode(context.StatusCode.ToString()); + context.WithCode(((int)context.StatusCode).ToString()); return; } - // TODO: 先从TttpStatusCodeFinder中查找 var wrapperOptions = context.ServiceProvider.GetRequiredService>().Value; context.WithCode(wrapperOptions.CodeWithUnhandled); } diff --git a/gateways/Directory.Build.props b/gateways/Directory.Build.props index adfe8e5e3..3c4300a98 100644 --- a/gateways/Directory.Build.props +++ b/gateways/Directory.Build.props @@ -6,7 +6,7 @@ 5.2.0 1.5.10 2.13.0 - 1.2.1.3 + 1.2.1.5 2.0.3 1.7.27 7.15.1 diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/InternalApiGatewayModule.Configure.cs b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/InternalApiGatewayModule.Configure.cs index 36b2f410f..4148d9578 100644 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/InternalApiGatewayModule.Configure.cs +++ b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/InternalApiGatewayModule.Configure.cs @@ -120,7 +120,8 @@ namespace LINGYUN.MicroService.Internal.ApiGateway private void ConfigureOcelot(IServiceCollection services, IConfiguration configuration) { - services.AddSingleton(); + // 需要合并自定义配置取消注释 + // services.AddSingleton(); services .AddOcelot(configuration) .AddPolly() diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/InternalApiGatewayOptions.cs b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/InternalApiGatewayOptions.cs index 431efceaa..c8cbecebc 100644 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/InternalApiGatewayOptions.cs +++ b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/InternalApiGatewayOptions.cs @@ -4,7 +4,6 @@ namespace LINGYUN.MicroService.Internal.ApiGateway { public class InternalApiGatewayOptions { - public string AppId { get; set; } public DownstreamOpenApi[] DownstreamOpenApis { get; set; } public InternalApiGatewayOptions() { diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/appsettings.Development.json b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/appsettings.Development.json index 32b7db74d..836e80b3f 100644 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/appsettings.Development.json +++ b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/appsettings.Development.json @@ -1,7 +1,7 @@ { "AgileConfig": { "env": "DEV", - "appId": "LINGYUN.Abp.ApiGateway", + "appId": "LINGYUN.Internal.ApiGateway", "secret": "1q2w3E*", "nodes": "http://127.0.0.1:5000", "name": "ApiGateway",