More tweaks
This commit is contained in:
parent
00fc3d8a65
commit
3fee612e68
@ -46,9 +46,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" />
|
||||
<ProjectReference Include="..\..\BuildingBlocks\EventBus\EventBusServiceBus\EventBusServiceBus.csproj" />
|
||||
<ProjectReference Include="..\..\BuildingBlocks\EventBus\EventBus\EventBus.csproj" />
|
||||
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" />
|
||||
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusServiceBus\EventBusServiceBus.csproj" />
|
||||
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBus\EventBus.csproj" />
|
||||
<ProjectReference Include="..\..\Services.Common\Services.Common.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -2,18 +2,13 @@
|
||||
|
||||
public static class CustomExtensionMethods
|
||||
{
|
||||
public static IServiceCollection AddRedis(this IServiceCollection services)
|
||||
public static IServiceCollection AddRedis(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
// {
|
||||
// "ConnectionString": "..."
|
||||
// }
|
||||
|
||||
return services.AddSingleton(sp =>
|
||||
{
|
||||
var settings = sp.GetRequiredService<IOptions<BasketSettings>>().Value;
|
||||
var configuration = ConfigurationOptions.Parse(settings.ConnectionString, true);
|
||||
var redisConfig = ConfigurationOptions.Parse(configuration.GetConnectionString("redis"), true);
|
||||
|
||||
return ConnectionMultiplexer.Connect(configuration);
|
||||
return ConnectionMultiplexer.Connect(redisConfig);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,4 @@
|
||||
global using Autofac.Extensions.DependencyInjection;
|
||||
global using Autofac;
|
||||
global using Azure.Core;
|
||||
global using Azure.Identity;
|
||||
global using Autofac;
|
||||
global using Basket.API.Infrastructure.ActionResults;
|
||||
global using Basket.API.Infrastructure.Exceptions;
|
||||
global using Basket.API.Infrastructure.Filters;
|
||||
@ -11,24 +8,15 @@ global using Basket.API.IntegrationEvents.Events;
|
||||
global using Basket.API.Model;
|
||||
global using Grpc.Core;
|
||||
global using GrpcBasket;
|
||||
global using HealthChecks.UI.Client;
|
||||
global using Microsoft.AspNetCore.Authorization;
|
||||
global using Microsoft.AspNetCore.Builder;
|
||||
global using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
global using Microsoft.AspNetCore.Hosting;
|
||||
global using Microsoft.AspNetCore.Http.Features;
|
||||
global using Microsoft.AspNetCore.Http;
|
||||
global using Microsoft.AspNetCore.Mvc.Authorization;
|
||||
global using Microsoft.AspNetCore.Mvc.Filters;
|
||||
global using Microsoft.AspNetCore.Mvc;
|
||||
global using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
global using Microsoft.AspNetCore;
|
||||
global using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||
global using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
global using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||
global using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
|
||||
global using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
|
||||
global using Microsoft.eShopOnContainers.Services.Basket.API.Controllers;
|
||||
global using Microsoft.eShopOnContainers.Services.Basket.API.Infrastructure.Repositories;
|
||||
global using Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.EventHandling;
|
||||
global using Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.Events;
|
||||
@ -37,19 +25,15 @@ global using Microsoft.eShopOnContainers.Services.Basket.API.Services;
|
||||
global using Microsoft.eShopOnContainers.Services.Basket.API;
|
||||
global using Microsoft.Extensions.Configuration;
|
||||
global using Microsoft.Extensions.DependencyInjection;
|
||||
global using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||
global using Microsoft.Extensions.Hosting;
|
||||
global using Microsoft.Extensions.Logging;
|
||||
global using Microsoft.Extensions.Options;
|
||||
global using Microsoft.OpenApi.Models;
|
||||
global using RabbitMQ.Client;
|
||||
global using Serilog.Context;
|
||||
global using Serilog;
|
||||
global using StackExchange.Redis;
|
||||
global using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
global using System.Collections.Generic;
|
||||
global using System.ComponentModel.DataAnnotations;
|
||||
global using System.IdentityModel.Tokens.Jwt;
|
||||
global using System.IO;
|
||||
global using System.Linq;
|
||||
global using System.Net;
|
||||
|
@ -21,9 +21,7 @@ builder.WebHost.UseFailing(options =>
|
||||
options.NotFilteredPaths.AddRange(new[] { "/hc", "/liveness" });
|
||||
});
|
||||
|
||||
builder.Services.Configure<BasketSettings>(builder.Configuration);
|
||||
|
||||
builder.Services.AddRedis();
|
||||
builder.Services.AddRedis(builder.Configuration);
|
||||
|
||||
builder.Services.AddTransient<ProductPriceChangedIntegrationEventHandler>();
|
||||
builder.Services.AddTransient<OrderStartedIntegrationEventHandler>();
|
||||
@ -33,7 +31,7 @@ builder.Services.AddTransient<IIdentityService, IdentityService>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.MapGet("hello", () => "hello");
|
||||
app.MapGet("/", () => Results.Redirect("/swagger"));
|
||||
|
||||
app.UseServiceDefaults();
|
||||
|
||||
|
@ -16,6 +16,9 @@
|
||||
"Protocols": "Http2"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"Redis": "127.0.0.1"
|
||||
},
|
||||
"EventBus": {
|
||||
"SubscriptionClientName": "Basket",
|
||||
"ConnectionString": "your-event-bus-connection-string",
|
||||
|
@ -11,9 +11,13 @@
|
||||
},
|
||||
"IdentityUrl": "http://localhost:5105",
|
||||
"IdentityUrlExternal": "http://localhost:5105",
|
||||
"ConnectionString": "127.0.0.1",
|
||||
"ConnectionStrings": {
|
||||
"Redis": "127.0.0.1"
|
||||
},
|
||||
"EventBus": {
|
||||
"ConnectionString": "localhost",
|
||||
"SubscriptionClientName": "Basket"
|
||||
},
|
||||
"isTest": "true",
|
||||
"EventBusConnection": "localhost",
|
||||
"SubscriptionClientName": "Basket",
|
||||
"SuppressCheckForUnhandledSecurityMetadata": true
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user