|
|
@ -2,41 +2,38 @@ |
|
|
|
using Autofac.Extensions.DependencyInjection; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
|
using Microsoft.Azure.ServiceBus; |
|
|
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; |
|
|
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; |
|
|
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; |
|
|
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; |
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using System; |
|
|
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; |
|
|
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; |
|
|
|
using RabbitMQ.Client; |
|
|
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; |
|
|
|
using Payment.API.IntegrationEvents.Events; |
|
|
|
using Payment.API.IntegrationEvents.EventHandling; |
|
|
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; |
|
|
|
using Microsoft.Azure.ServiceBus; |
|
|
|
using Payment.API.IntegrationEvents.Events; |
|
|
|
using RabbitMQ.Client; |
|
|
|
using System; |
|
|
|
|
|
|
|
namespace Payment.API |
|
|
|
{ |
|
|
|
public class Startup |
|
|
|
{ |
|
|
|
public Startup(IHostingEnvironment env) |
|
|
|
public Startup(IConfiguration configuration) |
|
|
|
{ |
|
|
|
var builder = new ConfigurationBuilder() |
|
|
|
.SetBasePath(env.ContentRootPath) |
|
|
|
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) |
|
|
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) |
|
|
|
.AddEnvironmentVariables(); |
|
|
|
Configuration = builder.Build(); |
|
|
|
Configuration = configuration; |
|
|
|
} |
|
|
|
|
|
|
|
public IConfigurationRoot Configuration { get; } |
|
|
|
public IConfiguration Configuration { get; } |
|
|
|
|
|
|
|
// This method gets called by the runtime. Use this method to add services to the container.
|
|
|
|
public IServiceProvider ConfigureServices(IServiceCollection services) |
|
|
|
{ |
|
|
|
// Add framework services.
|
|
|
|
services.AddMvc(); |
|
|
|
|
|
|
|
services.Configure<PaymentSettings>(Configuration); |
|
|
|
|
|
|
|
if (Configuration.GetValue<bool>("AzureServiceBusEnabled")) |
|
|
|
{ |
|
|
|
services.AddSingleton<IServiceBusPersisterConnection>(sp => |
|
|
@ -84,14 +81,10 @@ namespace Payment.API |
|
|
|
} |
|
|
|
|
|
|
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
|
|
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) |
|
|
|
{ |
|
|
|
loggerFactory.AddConsole(Configuration.GetSection("Logging")); |
|
|
|
loggerFactory.AddDebug(); |
|
|
|
|
|
|
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env) |
|
|
|
{ |
|
|
|
app.UseMvcWithDefaultRoute(); |
|
|
|
|
|
|
|
|
|
|
|
app.UseSwagger() |
|
|
|
.UseSwaggerUI(c => |
|
|
|
{ |
|
|
|