Browse Source

add nuget to ocelot

features/migration-dotnet3
Erik Pique 5 years ago
parent
commit
92eef22187
10 changed files with 27 additions and 43 deletions
  1. +1
    -0
      src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj
  2. +1
    -0
      src/ApiGateways/ApiGw-Base/Startup.cs
  3. +7
    -4
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/BasketData.cs
  4. +1
    -8
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/CatalogItem.cs
  5. +5
    -17
      src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs
  6. +7
    -4
      src/ApiGateways/Web.Bff.Shopping/aggregator/Models/BasketData.cs
  7. +1
    -8
      src/ApiGateways/Web.Bff.Shopping/aggregator/Models/CatalogItem.cs
  8. +1
    -0
      src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs
  9. +2
    -2
      src/Web/WebMVC/Startup.cs
  10. +1
    -0
      src/_build/dependencies.props

+ 1
- 0
src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj View File

@ -10,6 +10,7 @@
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="$(AspNetCore_HealthChecks_Uris)" /> <PackageReference Include="AspNetCore.HealthChecks.Uris" Version="$(AspNetCore_HealthChecks_Uris)" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="$(Microsoft_AspNetCore_Diagnostics_HealthChecks)" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="$(Microsoft_AspNetCore_Diagnostics_HealthChecks)" />
<PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="$(Microsoft_AspNetCore_HealthChecks)" /> <PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="$(Microsoft_AspNetCore_HealthChecks)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="$(Microsoft_AspNetCore_Mvc_Formatters_Json)" />
<PackageReference Include="Ocelot" Version="$(Ocelot)" /> <PackageReference Include="Ocelot" Version="$(Ocelot)" />
<PackageReference Include="Serilog.AspNetCore" Version="$(Serilog_AspNetCore)" /> <PackageReference Include="Serilog.AspNetCore" Version="$(Serilog_AspNetCore)" />
<PackageReference Include="Serilog.Sinks.Console" Version="$(Serilog_Sinks_Console)" /> <PackageReference Include="Serilog.Sinks.Console" Version="$(Serilog_Sinks_Console)" />


+ 1
- 0
src/ApiGateways/ApiGw-Base/Startup.cs View File

@ -92,6 +92,7 @@ namespace OcelotApiGw
app.UseRouting(); app.UseRouting();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {
endpoints.MapControllers();
endpoints.MapHealthChecks("/hc", new HealthCheckOptions() endpoints.MapHealthChecks("/hc", new HealthCheckOptions()
{ {
Predicate = _ => true, Predicate = _ => true,


+ 7
- 4
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/BasketData.cs View File

@ -1,15 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
{ {
public class BasketData public class BasketData
{ {
public string BuyerId { get; set; } public string BuyerId { get; set; }
public List<BasketDataItem> Items { get; set; } public List<BasketDataItem> Items { get; set; }
public BasketData()
{
}
public BasketData(string buyerId) public BasketData(string buyerId)
{ {
BuyerId = buyerId; BuyerId = buyerId;


+ 1
- 8
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Models/CatalogItem.cs View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
{ {
public class CatalogItem public class CatalogItem
{ {
@ -13,8 +8,6 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
public decimal Price { get; set; } public decimal Price { get; set; }
public string PictureUri { get; set; } public string PictureUri { get; set; }
} }
} }

+ 5
- 17
src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs View File

@ -5,7 +5,6 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config; using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Filters.Basket.API.Infrastructure.Filters; using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Filters.Basket.API.Infrastructure.Filters;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Infrastructure; using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Infrastructure;
@ -46,7 +45,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
.AddUrlGroup(new Uri(Configuration["PaymentUrlHC"]), name: "paymentapi-check", tags: new string[] { "paymentapi" }) .AddUrlGroup(new Uri(Configuration["PaymentUrlHC"]), name: "paymentapi-check", tags: new string[] { "paymentapi" })
.AddUrlGroup(new Uri(Configuration["LocationUrlHC"]), name: "locationapi-check", tags: new string[] { "locationapi" }); .AddUrlGroup(new Uri(Configuration["LocationUrlHC"]), name: "locationapi-check", tags: new string[] { "locationapi" });
services.AddCustomMvc(Configuration)
services.AddCustomRouting(Configuration)
.AddCustomAuthentication(Configuration) .AddCustomAuthentication(Configuration)
.AddDevspaces() .AddDevspaces()
.AddHttpServices(); .AddHttpServices();
@ -77,12 +76,13 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
app.UseHsts(); app.UseHsts();
} }
app.UseAuthentication();
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseRouting(); app.UseRouting();
app.UseAuthentication();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {
endpoints.MapDefaultControllerRoute(); endpoints.MapDefaultControllerRoute();
endpoints.MapControllers();
endpoints.MapHealthChecks("/hc", new HealthCheckOptions() endpoints.MapHealthChecks("/hc", new HealthCheckOptions()
{ {
Predicate = _ => true, Predicate = _ => true,
@ -108,14 +108,11 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
public static class ServiceCollectionExtensions public static class ServiceCollectionExtensions
{ {
public static IServiceCollection AddCustomMvc(this IServiceCollection services, IConfiguration configuration)
public static IServiceCollection AddCustomRouting(this IServiceCollection services, IConfiguration configuration)
{ {
services.AddOptions(); services.AddOptions();
services.Configure<UrlsConfig>(configuration.GetSection("urls")); services.Configure<UrlsConfig>(configuration.GetSection("urls"));
services.AddMvc()
.SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
services.AddControllers().AddNewtonsoftJson();
services.AddSwaggerGen(options => services.AddSwaggerGen(options =>
{ {
options.DescribeAllEnumsAsStrings(); options.DescribeAllEnumsAsStrings();
@ -174,15 +171,6 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
options.Authority = identityUrl; options.Authority = identityUrl;
options.RequireHttpsMetadata = false; options.RequireHttpsMetadata = false;
options.Audience = "mobileshoppingagg"; options.Audience = "mobileshoppingagg";
options.Events = new JwtBearerEvents()
{
OnAuthenticationFailed = async ctx =>
{
},
OnTokenValidated = async ctx =>
{
}
};
}); });
return services; return services;


+ 7
- 4
src/ApiGateways/Web.Bff.Shopping/aggregator/Models/BasketData.cs View File

@ -1,15 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
{ {
public class BasketData public class BasketData
{ {
public string BuyerId { get; set; } public string BuyerId { get; set; }
public List<BasketDataItem> Items { get; set; } public List<BasketDataItem> Items { get; set; }
public BasketData()
{
}
public BasketData(string buyerId) public BasketData(string buyerId)
{ {
BuyerId = buyerId; BuyerId = buyerId;


+ 1
- 8
src/ApiGateways/Web.Bff.Shopping/aggregator/Models/CatalogItem.cs View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
{ {
public class CatalogItem public class CatalogItem
{ {
@ -13,8 +8,6 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
public decimal Price { get; set; } public decimal Price { get; set; }
public string PictureUri { get; set; } public string PictureUri { get; set; }
} }
} }

+ 1
- 0
src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs View File

@ -82,6 +82,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {
endpoints.MapDefaultControllerRoute(); endpoints.MapDefaultControllerRoute();
endpoints.MapControllers();
endpoints.MapHealthChecks("/hc", new HealthCheckOptions() endpoints.MapHealthChecks("/hc", new HealthCheckOptions()
{ {
Predicate = _ => true, Predicate = _ => true,


+ 2
- 2
src/Web/WebMVC/Startup.cs View File

@ -81,16 +81,16 @@ namespace Microsoft.eShopOnContainers.WebMVC
app.UseMiddleware<ByPassAuthMiddleware>(); app.UseMiddleware<ByPassAuthMiddleware>();
} }
app.UseAuthentication();
WebContextSeed.Seed(app, env, loggerFactory); WebContextSeed.Seed(app, env, loggerFactory);
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseRouting(); app.UseRouting();
app.UseAuthentication();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {
endpoints.MapControllerRoute("default", "{controller=Catalog}/{action=Index}/{id?}"); endpoints.MapControllerRoute("default", "{controller=Catalog}/{action=Index}/{id?}");
endpoints.MapControllerRoute("defaultError", "{controller=Error}/{action=Error}"); endpoints.MapControllerRoute("defaultError", "{controller=Error}/{action=Error}");
endpoints.MapControllers();
endpoints.MapHealthChecks("/liveness", new HealthCheckOptions endpoints.MapHealthChecks("/liveness", new HealthCheckOptions
{ {
Predicate = r => r.Name.Contains("self") Predicate = r => r.Name.Contains("self")


+ 1
- 0
src/_build/dependencies.props View File

@ -40,6 +40,7 @@
<Microsoft_AspNet_WebApi_Client>5.2.7</Microsoft_AspNet_WebApi_Client> <Microsoft_AspNet_WebApi_Client>5.2.7</Microsoft_AspNet_WebApi_Client>
<Microsoft_Build_Utilities_Core>15.9.20</Microsoft_Build_Utilities_Core> <Microsoft_Build_Utilities_Core>15.9.20</Microsoft_Build_Utilities_Core>
<Microsoft_Web_LibraryManager_Build>1.0.172</Microsoft_Web_LibraryManager_Build> <Microsoft_Web_LibraryManager_Build>1.0.172</Microsoft_Web_LibraryManager_Build>
<Microsoft_AspNetCore_Mvc_Formatters_Json>3.0.0-preview4-19123-01</Microsoft_AspNetCore_Mvc_Formatters_Json>
<Microsoft_VisualStudio_Azure_Containers_Tools_Targets>1.0.2105168</Microsoft_VisualStudio_Azure_Containers_Tools_Targets> <Microsoft_VisualStudio_Azure_Containers_Tools_Targets>1.0.2105168</Microsoft_VisualStudio_Azure_Containers_Tools_Targets>
<Microsoft_VisualStudio_Web_CodeGeneration_Design>3.0.0-preview6-19319-03</Microsoft_VisualStudio_Web_CodeGeneration_Design> <Microsoft_VisualStudio_Web_CodeGeneration_Design>3.0.0-preview6-19319-03</Microsoft_VisualStudio_Web_CodeGeneration_Design>
<MediatR_Extensions_Microsoft_DependencyInjection>5.1.0</MediatR_Extensions_Microsoft_DependencyInjection> <MediatR_Extensions_Microsoft_DependencyInjection>5.1.0</MediatR_Extensions_Microsoft_DependencyInjection>


Loading…
Cancel
Save