11 changed files with 0 additions and 382 deletions
@ -1,32 +0,0 @@ |
|||
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00 |
|||
# Visual Studio Version 16 |
|||
VisualStudioVersion = 16.0.31320.298 |
|||
MinimumVisualStudioVersion = 10.0.40219.1 |
|||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{138BBFFC-09B9-49FB-9C57-E25327CCE0C1}" |
|||
EndProject |
|||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{A5E7F07B-7A5D-416D-A9E0-2009A48CBE2A}" |
|||
EndProject |
|||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EShopOnAbp.InternalGateway", "src\EShopOnAbp.InternalGateway\EShopOnAbp.InternalGateway.csproj", "{EB7B7C24-2A6D-4500-B8E0-2988EF65DC8C}" |
|||
EndProject |
|||
Global |
|||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|||
Debug|Any CPU = Debug|Any CPU |
|||
Release|Any CPU = Release|Any CPU |
|||
EndGlobalSection |
|||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
|||
{EB7B7C24-2A6D-4500-B8E0-2988EF65DC8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{EB7B7C24-2A6D-4500-B8E0-2988EF65DC8C}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{EB7B7C24-2A6D-4500-B8E0-2988EF65DC8C}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{EB7B7C24-2A6D-4500-B8E0-2988EF65DC8C}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
EndGlobalSection |
|||
GlobalSection(SolutionProperties) = preSolution |
|||
HideSolutionNode = FALSE |
|||
EndGlobalSection |
|||
GlobalSection(NestedProjects) = preSolution |
|||
{EB7B7C24-2A6D-4500-B8E0-2988EF65DC8C} = {138BBFFC-09B9-49FB-9C57-E25327CCE0C1} |
|||
EndGlobalSection |
|||
GlobalSection(ExtensibilityGlobals) = postSolution |
|||
SolutionGuid = {1753A143-A9EF-43ED-970D-C71BAD179AE6} |
|||
EndGlobalSection |
|||
EndGlobal |
|||
@ -1,13 +0,0 @@ |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
|
|||
namespace EShopOnAbp.InternalGateway.Controllers |
|||
{ |
|||
public class HomeController : AbpController |
|||
{ |
|||
public ActionResult Index() |
|||
{ |
|||
return Redirect("/swagger"); |
|||
} |
|||
} |
|||
} |
|||
@ -1,4 +0,0 @@ |
|||
FROM mcr.microsoft.com/dotnet/aspnet:6.0 |
|||
COPY bin/Release/net6.0/publish/ app/ |
|||
WORKDIR /app |
|||
ENTRYPOINT ["dotnet", "EShopOnAbp.InternalGateway.dll"] |
|||
@ -1,19 +0,0 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
</PropertyGroup> |
|||
|
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\..\..\shared\EShopOnAbp.Shared.Hosting.Gateways\EShopOnAbp.Shared.Hosting.Gateways.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<Compile Remove="Logs\**" /> |
|||
<Content Remove="Logs\**" /> |
|||
<EmbeddedResource Remove="Logs\**" /> |
|||
<None Remove="Logs\**" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -1,71 +0,0 @@ |
|||
using EShopOnAbp.Shared.Hosting.Gateways; |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Hosting; |
|||
using Ocelot.Middleware; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using EShopOnAbp.Shared.Hosting.AspNetCore; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace EShopOnAbp.InternalGateway |
|||
{ |
|||
[DependsOn( |
|||
typeof(EShopOnAbpSharedHostingGatewaysModule) |
|||
)] |
|||
public class EShopOnAbpInternalGatewayModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
var configuration = context.Services.GetConfiguration(); |
|||
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
|||
SwaggerConfigurationHelper.Configure(context, "Internal Gateway"); |
|||
} |
|||
|
|||
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|||
{ |
|||
var app = context.GetApplicationBuilder(); |
|||
var env = context.GetEnvironment(); |
|||
|
|||
if (env.IsDevelopment()) |
|||
{ |
|||
app.UseDeveloperExceptionPage(); |
|||
} |
|||
|
|||
app.UseCorrelationId(); |
|||
app.UseSwagger(); |
|||
app.UseSwaggerUI(options => |
|||
{ |
|||
var configuration = context.ServiceProvider.GetRequiredService<IConfiguration>(); |
|||
var routes = configuration.GetSection("Routes").Get<List<OcelotConfiguration>>(); |
|||
|
|||
foreach (var config in routes.GroupBy(t => t.ServiceKey).Select(r => r.First()).Distinct()) |
|||
{ |
|||
var url = |
|||
$"{config.DownstreamScheme}://{config.DownstreamHostAndPorts.FirstOrDefault()?.Host}:{config.DownstreamHostAndPorts.FirstOrDefault()?.Port}"; |
|||
if (!env.IsDevelopment()) |
|||
{ |
|||
url = $"https://{config.DownstreamHostAndPorts.FirstOrDefault()?.Host}"; |
|||
} |
|||
|
|||
options.SwaggerEndpoint($"{url}/swagger/v1/swagger.json", $"{config.ServiceKey} API"); |
|||
options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); |
|||
options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); |
|||
} |
|||
}); |
|||
app.UseAbpSerilogEnrichers(); |
|||
app.MapWhen( |
|||
ctx => ctx.Request.Path.ToString().StartsWith("/api/abp/api-definition") || |
|||
ctx.Request.Path.ToString().TrimEnd('/').Equals(""), |
|||
app2 => |
|||
{ |
|||
app2.UseRouting(); |
|||
app2.UseConfiguredEndpoints(); |
|||
} |
|||
); |
|||
app.UseOcelot().Wait(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,46 +0,0 @@ |
|||
using EShopOnAbp.Shared.Hosting.AspNetCore; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.Hosting; |
|||
using Serilog; |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace EShopOnAbp.InternalGateway |
|||
{ |
|||
public class Program |
|||
{ |
|||
public static async Task<int> Main(string[] args) |
|||
{ |
|||
var assemblyName = typeof(Program).Assembly.GetName().Name; |
|||
|
|||
SerilogConfigurationHelper.Configure(assemblyName); |
|||
|
|||
try |
|||
{ |
|||
Log.Information($"Starting {assemblyName}."); |
|||
await CreateHostBuilder(args).Build().RunAsync(); |
|||
return 0; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
Log.Fatal(ex, $"{assemblyName} terminated unexpectedly!"); |
|||
return 1; |
|||
} |
|||
finally |
|||
{ |
|||
Log.CloseAndFlush(); |
|||
} |
|||
} |
|||
|
|||
internal static IHostBuilder CreateHostBuilder(string[] args) => |
|||
Host.CreateDefaultBuilder(args) |
|||
.ConfigureAppConfiguration(build => |
|||
{ |
|||
build.AddJsonFile("appsettings.secrets.json", optional: true); |
|||
}) |
|||
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); }) |
|||
.UseAutofac() |
|||
.UseSerilog(); |
|||
} |
|||
} |
|||
@ -1,29 +0,0 @@ |
|||
{ |
|||
"$schema": "http://json.schemastore.org/launchsettings.json", |
|||
"iisSettings": { |
|||
"windowsAuthentication": false, |
|||
"anonymousAuthentication": true, |
|||
"iisExpress": { |
|||
"applicationUrl": "https://localhost:44371", |
|||
"sslPort": 0 |
|||
} |
|||
}, |
|||
"profiles": { |
|||
"IIS Express": { |
|||
"commandName": "IISExpress", |
|||
"launchBrowser": true, |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
}, |
|||
"EShopOnAbp.InternalGateway": { |
|||
"commandName": "Project", |
|||
"dotnetRunMessages": "true", |
|||
"launchBrowser": true, |
|||
"applicationUrl": "https://localhost:44371", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,19 +0,0 @@ |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
|
|||
namespace EShopOnAbp.InternalGateway |
|||
{ |
|||
public class Startup |
|||
{ |
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddApplication<EShopOnAbpInternalGatewayModule>(); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) |
|||
{ |
|||
app.InitializeApplication(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,9 +0,0 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
} |
|||
} |
|||
@ -1,133 +0,0 @@ |
|||
{ |
|||
"App": { |
|||
"SelfUrl": "https://localhost:44371" |
|||
}, |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
}, |
|||
"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": "Identity Service", |
|||
"DownstreamPathTemplate": "/api/account/{everything}", |
|||
"DownstreamScheme": "https", |
|||
"DownstreamHostAndPorts": [ |
|||
{ |
|||
"Host": "localhost", |
|||
"Port": 44351 |
|||
} |
|||
], |
|||
"UpstreamPathTemplate": "/api/account/{everything}", |
|||
"UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] |
|||
}, |
|||
{ |
|||
"ServiceKey": "Saas Service", |
|||
"DownstreamPathTemplate": "/api/saas/{everything}", |
|||
"DownstreamScheme": "https", |
|||
"DownstreamHostAndPorts": [ |
|||
{ |
|||
"Host": "localhost", |
|||
"Port": 44352 |
|||
} |
|||
], |
|||
"UpstreamPathTemplate": "/api/saas/{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": 5, |
|||
"DurationOfBreak": 3000, |
|||
"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" ] |
|||
}, |
|||
{ |
|||
"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:44371" |
|||
}, |
|||
"Redis": { |
|||
"Configuration": "localhost:6379" |
|||
}, |
|||
"ElasticSearch": { |
|||
"Url": "http://localhost:9200" |
|||
} |
|||
} |
|||
Loading…
Reference in new issue