diff --git a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/Program.cs b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/Program.cs index b7e61272..d60f0442 100644 --- a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/Program.cs +++ b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/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.WebPublicGateway; @@ -17,10 +19,19 @@ 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-public/src/EShopOnAbp.WebPublicGateway/appsettings.json b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/appsettings.json index 1eee0654..dfe10330 100644 --- a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/appsettings.json +++ b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/appsettings.json @@ -17,104 +17,7 @@ } }, "AllowedHosts": "*", - "Routes": [ - { - "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": 3000, - "TimeoutValue": 2500 - } - }, - { - "ServiceKey": "Catalog Service", - "DownstreamPathTemplate": "/api/catalog/{everything}", - "DownstreamScheme": "https", - "DownstreamHostAndPorts": [ - { - "Host": "localhost", - "Port": 44354 - } - ], - "UpstreamPathTemplate": "/api/catalog/{everything}", - "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ], - "QoSOptions": { - "ExceptionsAllowedBeforeBreaking": 3, - "DurationOfBreak": 3000, - "TimeoutValue": 2500 - } - }, - { - "ServiceKey": "Basket Service", - "DownstreamPathTemplate": "/api/basket/{everything}", - "DownstreamScheme": "https", - "DownstreamHostAndPorts": [ - { - "Host": "localhost", - "Port": 44355 - } - ], - "UpstreamPathTemplate": "/api/basket/{everything}", - "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ], - "QoSOptions": { - "ExceptionsAllowedBeforeBreaking": 3, - "DurationOfBreak": 3000, - "TimeoutValue": 2500 - } - }, - { - "ServiceKey": "Ordering Service", - "DownstreamPathTemplate": "/api/ordering/{everything}", - "DownstreamScheme": "https", - "DownstreamHostAndPorts": [ - { - "Host": "localhost", - "Port": 44356 - } - ], - "UpstreamPathTemplate": "/api/ordering/{everything}", - "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] - }, - { - "ServiceKey": "Payment Service", - "DownstreamPathTemplate": "/api/payment/{everything}", - "DownstreamScheme": "https", - "DownstreamHostAndPorts": [ - { - "Host": "localhost", - "Port": 44357 - } - ], - "UpstreamPathTemplate": "/api/payment/{everything}", - "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] - } - ], - "GlobalConfiguration": { - "BaseUrl": "https://localhost:44373" - }, + "Redis": { "Configuration": "localhost:6379" }, diff --git a/gateways/web-public/src/EShopOnAbp.WebPublicGateway/ocelot.json b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/ocelot.json new file mode 100644 index 00000000..5c94283d --- /dev/null +++ b/gateways/web-public/src/EShopOnAbp.WebPublicGateway/ocelot.json @@ -0,0 +1,100 @@ +{ + "GlobalConfiguration": { + "BaseUrl": "https://localhost:44373" + }, + "Routes": [ + { + "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": 3000, + "TimeoutValue": 2500 + } + }, + { + "ServiceKey": "Catalog Service", + "DownstreamPathTemplate": "/api/catalog/{everything}", + "DownstreamScheme": "https", + "DownstreamHostAndPorts": [ + { + "Host": "localhost", + "Port": 44354 + } + ], + "UpstreamPathTemplate": "/api/catalog/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ], + "QoSOptions": { + "ExceptionsAllowedBeforeBreaking": 3, + "DurationOfBreak": 3000, + "TimeoutValue": 2500 + } + }, + { + "ServiceKey": "Basket Service", + "DownstreamPathTemplate": "/api/basket/{everything}", + "DownstreamScheme": "https", + "DownstreamHostAndPorts": [ + { + "Host": "localhost", + "Port": 44355 + } + ], + "UpstreamPathTemplate": "/api/basket/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ], + "QoSOptions": { + "ExceptionsAllowedBeforeBreaking": 3, + "DurationOfBreak": 3000, + "TimeoutValue": 2500 + } + }, + { + "ServiceKey": "Ordering Service", + "DownstreamPathTemplate": "/api/ordering/{everything}", + "DownstreamScheme": "https", + "DownstreamHostAndPorts": [ + { + "Host": "localhost", + "Port": 44356 + } + ], + "UpstreamPathTemplate": "/api/ordering/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + }, + { + "ServiceKey": "Payment Service", + "DownstreamPathTemplate": "/api/payment/{everything}", + "DownstreamScheme": "https", + "DownstreamHostAndPorts": [ + { + "Host": "localhost", + "Port": 44357 + } + ], + "UpstreamPathTemplate": "/api/payment/{everything}", + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] + } + ] +} \ No newline at end of file