|
21 | 21 | using Microsoft.Extensions.Logging; |
22 | 22 | using Microsoft.WindowsAzure.ServiceRuntime; |
23 | 23 | using NuGet.Services.Entities; |
| 24 | +using NuGet.Services.FeatureFlags; |
24 | 25 | using NuGet.Services.KeyVault; |
25 | 26 | using NuGet.Services.Licenses; |
26 | 27 | using NuGet.Services.Logging; |
|
38 | 39 | using NuGetGallery.Configuration; |
39 | 40 | using NuGetGallery.Cookies; |
40 | 41 | using NuGetGallery.Diagnostics; |
| 42 | +using NuGetGallery.Features; |
41 | 43 | using NuGetGallery.Infrastructure; |
42 | 44 | using NuGetGallery.Infrastructure.Authentication; |
43 | 45 | using NuGetGallery.Infrastructure.Lucene; |
@@ -111,7 +113,11 @@ protected override void Load(ContainerBuilder builder) |
111 | 113 | builder.Register(c => configuration.PackageDelete) |
112 | 114 | .As<IPackageDeleteConfiguration>(); |
113 | 115 |
|
114 | | - builder.RegisterType<TelemetryService>().As<ITelemetryService>().SingleInstance(); |
| 116 | + builder.RegisterType<TelemetryService>() |
| 117 | + .As<ITelemetryService>() |
| 118 | + .As<IFeatureFlagTelemetryService>() |
| 119 | + .SingleInstance(); |
| 120 | + |
115 | 121 | builder.RegisterType<CredentialBuilder>().As<ICredentialBuilder>().SingleInstance(); |
116 | 122 | builder.RegisterType<CredentialValidator>().As<ICredentialValidator>().SingleInstance(); |
117 | 123 |
|
@@ -358,6 +364,7 @@ protected override void Load(ContainerBuilder builder) |
358 | 364 | .As<ILicenseExpressionSegmentator>() |
359 | 365 | .InstancePerLifetimeScope(); |
360 | 366 |
|
| 367 | + RegisterFeatureFlagsService(builder, configuration); |
361 | 368 | RegisterMessagingService(builder, configuration); |
362 | 369 |
|
363 | 370 | builder.Register(c => HttpContext.Current.User) |
@@ -406,6 +413,32 @@ protected override void Load(ContainerBuilder builder) |
406 | 413 | ConfigureAutocomplete(builder, configuration); |
407 | 414 | } |
408 | 415 |
|
| 416 | + private static void RegisterFeatureFlagsService(ContainerBuilder builder, ConfigurationService configuration) |
| 417 | + { |
| 418 | + builder |
| 419 | + .Register(context => new FeatureFlagOptions |
| 420 | + { |
| 421 | + RefreshInterval = configuration.Current.FeatureFlagsRefreshInterval, |
| 422 | + }) |
| 423 | + .AsSelf() |
| 424 | + .SingleInstance(); |
| 425 | + |
| 426 | + builder |
| 427 | + .RegisterType<FeatureFlagCacheService>() |
| 428 | + .As<IFeatureFlagCacheService>() |
| 429 | + .SingleInstance(); |
| 430 | + |
| 431 | + builder |
| 432 | + .RegisterType<FeatureFlagClient>() |
| 433 | + .As<IFeatureFlagClient>() |
| 434 | + .SingleInstance(); |
| 435 | + |
| 436 | + builder |
| 437 | + .RegisterType<FeatureFlagService>() |
| 438 | + .As<IFeatureFlagService>() |
| 439 | + .SingleInstance(); |
| 440 | + } |
| 441 | + |
409 | 442 | private static void RegisterMessagingService(ContainerBuilder builder, ConfigurationService configuration) |
410 | 443 | { |
411 | 444 | if (configuration.Current.AsynchronousEmailServiceEnabled) |
|
0 commit comments