diff --git a/gateways/web/src/EShopOnAbp.WebGateway/Program.cs b/gateways/web/src/EShopOnAbp.WebGateway/Program.cs index 03378683..244114fe 100644 --- a/gateways/web/src/EShopOnAbp.WebGateway/Program.cs +++ b/gateways/web/src/EShopOnAbp.WebGateway/Program.cs @@ -3,6 +3,8 @@ using Serilog; using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; namespace EShopOnAbp.WebGateway; @@ -17,10 +19,18 @@ public class Program try { Log.Information($"Starting {assemblyName}."); - var app = await ApplicationBuilderHelper.BuildApplicationAsync(args); + var builder = WebApplication.CreateBuilder(args); + builder.Host + .AddAppSettingsSecretsJson() + .AddOcelotJson() + .UseAutofac() + .UseSerilog(); + + await builder.AddApplicationAsync(); + var app = builder.Build(); await app.InitializeApplicationAsync(); await app.RunAsync(); - + return 0; } catch (Exception ex) diff --git a/gateways/web/src/EShopOnAbp.WebGateway/appsettings.json b/gateways/web/src/EShopOnAbp.WebGateway/appsettings.json index 091f7419..dea2bd3b 100644 --- a/gateways/web/src/EShopOnAbp.WebGateway/appsettings.json +++ b/gateways/web/src/EShopOnAbp.WebGateway/appsettings.json @@ -17,94 +17,7 @@ } }, "AllowedHosts": "*", - "Routes": [ - { - "ServiceKey": "Identity Service", - "DownstreamPathTemplate": "/api/identity/{everything}", - "DownstreamScheme": "https", - "DownstreamHostAndPorts": [ - { - "Host": "localhost", - "Port": 44351 - } - ], - "UpstreamPathTemplate": "/api/identity/{everything}", - "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] - }, - { - "ServiceKey": "Account Service", - "DownstreamPathTemplate": "/api/account/{everything}", - "DownstreamScheme": "https", - "DownstreamHostAndPorts": [ - { - "Host": "localhost", - "Port": 44330 - } - ], - "UpstreamPathTemplate": "/api/account/{everything}", - "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] - }, - { - "ServiceKey": "Administration Service", - "DownstreamPathTemplate": "/api/abp/{everything}", - "DownstreamScheme": "https", - "DownstreamHostAndPorts": [ - { - "Host": "localhost", - "Port": 44353 - } - ], - "UpstreamPathTemplate": "/api/abp/{everything}", - "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ], - "QoSOptions": { - "ExceptionsAllowedBeforeBreaking": 3, - "DurationOfBreak": 5000, - "TimeoutValue": 2500 - } - }, - { - "ServiceKey": "Administration Service", - "DownstreamPathTemplate": "/api/feature-management/{everything}", - "DownstreamScheme": "https", - "DownstreamHostAndPorts": [ - { - "Host": "localhost", - "Port": 44353 - } - ], - "UpstreamPathTemplate": "/api/feature-management/{everything}", - "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] - }, - { - "ServiceKey": "Administration Service", - "DownstreamPathTemplate": "/api/permission-management/{everything}", - "DownstreamScheme": "https", - "DownstreamHostAndPorts": [ - { - "Host": "localhost", - "Port": 44353 - } - ], - "UpstreamPathTemplate": "/api/permission-management/{everything}", - "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] - }, - { - "ServiceKey": "Administration Service", - "DownstreamPathTemplate": "/api/setting-management/{everything}", - "DownstreamScheme": "https", - "DownstreamHostAndPorts": [ - { - "Host": "localhost", - "Port": 44353 - } - ], - "UpstreamPathTemplate": "/api/setting-management/{everything}", - "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] - } - ], - "GlobalConfiguration": { - "BaseUrl": "https://localhost:44372" - }, + "Redis": { "Configuration": "localhost:6379" }, diff --git a/gateways/web/src/EShopOnAbp.WebGateway/ocelot.json b/gateways/web/src/EShopOnAbp.WebGateway/ocelot.json new file mode 100644 index 00000000..affe35be --- /dev/null +++ b/gateways/web/src/EShopOnAbp.WebGateway/ocelot.json @@ -0,0 +1,90 @@ +{ + "GlobalConfiguration": { + "BaseUrl": "https://localhost:44372" + }, + "Routes": [ + { + "ServiceKey": "Identity Service", + "DownstreamPathTemplate": "/api/identity/{everything}", + "DownstreamScheme": "https", + "DownstreamHostAndPorts": [ + { + "Host": "localhost", + "Port": 44351 + } + ], + "UpstreamPathTemplate": "/api/identity/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Account Service", + "DownstreamPathTemplate": "/api/account/{everything}", + "DownstreamScheme": "https", + "DownstreamHostAndPorts": [ + { + "Host": "localhost", + "Port": 44330 + } + ], + "UpstreamPathTemplate": "/api/account/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Administration Service", + "DownstreamPathTemplate": "/api/abp/{everything}", + "DownstreamScheme": "https", + "DownstreamHostAndPorts": [ + { + "Host": "localhost", + "Port": 44353 + } + ], + "UpstreamPathTemplate": "/api/abp/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ], + "QoSOptions": { + "ExceptionsAllowedBeforeBreaking": 3, + "DurationOfBreak": 5000, + "TimeoutValue": 2500 + } + }, + { + "ServiceKey": "Administration Service", + "DownstreamPathTemplate": "/api/feature-management/{everything}", + "DownstreamScheme": "https", + "DownstreamHostAndPorts": [ + { + "Host": "localhost", + "Port": 44353 + } + ], + "UpstreamPathTemplate": "/api/feature-management/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Administration Service", + "DownstreamPathTemplate": "/api/permission-management/{everything}", + "DownstreamScheme": "https", + "DownstreamHostAndPorts": [ + { + "Host": "localhost", + "Port": 44353 + } + ], + "UpstreamPathTemplate": "/api/permission-management/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Administration Service", + "DownstreamPathTemplate": "/api/setting-management/{everything}", + "DownstreamScheme": "https", + "DownstreamHostAndPorts": [ + { + "Host": "localhost", + "Port": 44353 + } + ], + "UpstreamPathTemplate": "/api/setting-management/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + } + ] +} \ No newline at end of file