Split redis and health checks for redis
This commit is contained in:
		
							parent
							
								
									08e7c3424d
								
							
						
					
					
						commit
						a41560544c
					
				| @ -2,15 +2,16 @@ | |||||||
| 
 | 
 | ||||||
| public static class CustomExtensionMethods | public static class CustomExtensionMethods | ||||||
| { | { | ||||||
|     public static IServiceCollection AddRedis(this IServiceCollection services, IConfiguration configuration) |     public static IServiceCollection AddHealthChecks(this IServiceCollection services, IConfiguration configuration) | ||||||
|     { |     { | ||||||
|         services.AddHealthChecks() |         services.AddHealthChecks() | ||||||
|             .AddRedis(_ => |             .AddRedis(_ => configuration.GetConnectionString("redis"), "redis", tags: new[] { "ready", "liveness" }); | ||||||
|             { |  | ||||||
|                 return configuration.GetConnectionString("redis"); |  | ||||||
|             }, |  | ||||||
|             "redis", tags: new[] { "ready", "liveness" }); |  | ||||||
| 
 | 
 | ||||||
|  |         return services; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public static IServiceCollection AddRedis(this IServiceCollection services, IConfiguration configuration) | ||||||
|  |     { | ||||||
|         return services.AddSingleton(sp => |         return services.AddSingleton(sp => | ||||||
|         { |         { | ||||||
|             var redisConfig = ConfigurationOptions.Parse(configuration.GetConnectionString("redis"), true); |             var redisConfig = ConfigurationOptions.Parse(configuration.GetConnectionString("redis"), true); | ||||||
|  | |||||||
| @ -6,6 +6,7 @@ builder.Services.AddGrpc(); | |||||||
| builder.Services.AddControllers(); | builder.Services.AddControllers(); | ||||||
| builder.Services.AddProblemDetails(); | builder.Services.AddProblemDetails(); | ||||||
| 
 | 
 | ||||||
|  | builder.Services.AddHealthChecks(builder.Configuration); | ||||||
| builder.Services.AddRedis(builder.Configuration); | builder.Services.AddRedis(builder.Configuration); | ||||||
| 
 | 
 | ||||||
| builder.Services.AddTransient<ProductPriceChangedIntegrationEventHandler>(); | builder.Services.AddTransient<ProductPriceChangedIntegrationEventHandler>(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user