|
20 | 20 | using OpenFeature.Contrib.Hooks.Otel;
|
21 | 21 |
|
22 | 22 | var builder = WebApplication.CreateBuilder(args);
|
23 |
| -string redisAddress = builder.Configuration["REDIS_ADDR"]; |
24 |
| -if (string.IsNullOrEmpty(redisAddress)) |
| 23 | +string valkeyAddress = builder.Configuration["VALKEY_ADDR"]; |
| 24 | +if (string.IsNullOrEmpty(valkeyAddress)) |
25 | 25 | {
|
26 |
| - Console.WriteLine("REDIS_ADDR environment variable is required."); |
| 26 | + Console.WriteLine("VALKEY_ADDR environment variable is required."); |
27 | 27 | Environment.Exit(1);
|
28 | 28 | }
|
29 | 29 |
|
|
33 | 33 |
|
34 | 34 | builder.Services.AddSingleton<ICartStore>(x=>
|
35 | 35 | {
|
36 |
| - var store = new RedisCartStore(x.GetRequiredService<ILogger<RedisCartStore>>(), redisAddress); |
| 36 | + var store = new ValkeyCartStore(x.GetRequiredService<ILogger<ValkeyCartStore>>(), valkeyAddress); |
37 | 37 | store.Initialize();
|
38 | 38 | return store;
|
39 | 39 | });
|
|
48 | 48 | builder.Services.AddSingleton(x =>
|
49 | 49 | new CartService(
|
50 | 50 | x.GetRequiredService<ICartStore>(),
|
51 |
| - new RedisCartStore(x.GetRequiredService<ILogger<RedisCartStore>>(), "badhost:1234"), |
| 51 | + new ValkeyCartStore(x.GetRequiredService<ILogger<ValkeyCartStore>>(), "badhost:1234"), |
52 | 52 | x.GetRequiredService<IFeatureClient>()
|
53 | 53 | ));
|
54 | 54 |
|
|
79 | 79 |
|
80 | 80 | var app = builder.Build();
|
81 | 81 |
|
82 |
| -var redisCartStore = (RedisCartStore) app.Services.GetRequiredService<ICartStore>(); |
83 |
| -app.Services.GetRequiredService<StackExchangeRedisInstrumentation>().AddConnection(redisCartStore.GetConnection()); |
| 82 | +var ValkeyCartStore = (ValkeyCartStore) app.Services.GetRequiredService<ICartStore>(); |
| 83 | +app.Services.GetRequiredService<StackExchangeRedisInstrumentation>().AddConnection(ValkeyCartStore.GetConnection()); |
84 | 84 |
|
85 | 85 | app.MapGrpcService<CartService>();
|
86 | 86 | app.MapGrpcHealthChecksService();
|
|
0 commit comments