Browse Source

Updated gateways

pull/67/head
Galip Tolga Erdem 5 years ago
parent
commit
5544a83703
  1. 16
      gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs
  2. 4
      gateways/web-public/src/EShopOnAbp.WebPublicGateway/appsettings.json
  3. 8
      gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs

16
gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs

@ -43,10 +43,12 @@ namespace EShopOnAbp.WebPublicGateway
{
var configuration = context.ServiceProvider.GetRequiredService<IConfiguration>();
var routes = configuration.GetSection("Routes").Get<List<OcelotConfiguration>>();
var routedServices = routes.GroupBy(t => t.ServiceKey).Select(r => r.First()).Distinct();
var routedServices = routes
.GroupBy(t => t.ServiceKey)
.Select(r => r.First())
.Distinct();
//TODO : AccountService (AuthServer) doesn't have any swagger end point
foreach (var config in routedServices.Where(q => !q.ServiceKey.StartsWith("Account")))
foreach (var config in routedServices)
{
var url =
$"{config.DownstreamScheme}://{config.DownstreamHostAndPorts.FirstOrDefault()?.Host}:{config.DownstreamHostAndPorts.FirstOrDefault()?.Port}";
@ -56,8 +58,12 @@ namespace EShopOnAbp.WebPublicGateway
}
options.SwaggerEndpoint($"{url}/swagger/v1/swagger.json", $"{config.ServiceKey} API");
options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]);
options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]);
// options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]);
// options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]);
// TODO: Find a way to get these configurations from related running applications settings.
// options.OAuthClientId($"{config.ServiceKey.Replace(" ","")}_Swagger");
// options.OAuthClientSecret("1q2w3e*");
}
});
app.UseAbpSerilogEnrichers();

4
gateways/web-public/src/EShopOnAbp.WebPublicGateway/appsettings.json

@ -5,9 +5,7 @@
},
"AuthServer": {
"Authority": "https://localhost:44330",
"RequireHttpsMetadata": "true",
"SwaggerClientId": "WebPublicGateway_Swagger",
"SwaggerClientSecret": "1q2w3e*"
"RequireHttpsMetadata": "true"
},
"Logging": {
"LogLevel": {

8
gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs

@ -63,10 +63,12 @@ namespace EShopOnAbp.WebGateway
{
var configuration = context.ServiceProvider.GetRequiredService<IConfiguration>();
var routes = configuration.GetSection("Routes").Get<List<OcelotConfiguration>>();
var routedServices = routes.GroupBy(t => t.ServiceKey).Select(r => r.First()).Distinct();
var routedServices = routes
.GroupBy(t => t.ServiceKey)
.Select(r => r.First())
.Distinct();
//TODO : AccountService (AuthServer) doesn't have any swagger end point
foreach (var config in routedServices.Where(q => !q.ServiceKey.StartsWith("Account")))
foreach (var config in routedServices)
{
var url =
$"{config.DownstreamScheme}://{config.DownstreamHostAndPorts.FirstOrDefault()?.Host}:{config.DownstreamHostAndPorts.FirstOrDefault()?.Port}";

Loading…
Cancel
Save