File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 3535 builder . Configuration . AddAzureKeyVault ( keyVaultUri , new DefaultAzureCredential ( ) ) ;
3636 }
3737
38- builder . Services . ConfigureServices ( ) ;
38+ builder . Services . ConfigureServices ( builder . Environment ) ;
3939
4040 builder . Host . UseSerilog ( ( ctx , services , loggerConfig ) =>
4141 {
Original file line number Diff line number Diff line change @@ -13,9 +13,12 @@ namespace Api.Setup;
1313
1414internal static class ApiServices
1515{
16- public static void ConfigureServices ( this IServiceCollection services )
16+ public static void ConfigureServices ( this IServiceCollection services , IWebHostEnvironment environment )
1717 {
18- services . AddApplicationInsightsTelemetry ( ) ;
18+ if ( environment . IsProduction ( ) )
19+ {
20+ services . AddApplicationInsightsTelemetry ( ) ;
21+ }
1922
2023 services . AddSerilog ( ) ;
2124
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ public class ServiceRegistrationTests
1212 public void ShouldHave_Scoped_MarketClient ( )
1313 {
1414 var builder = WebApplication . CreateBuilder ( ) ;
15- builder . Services . ConfigureServices ( ) ;
15+ builder . Services . ConfigureServices ( builder . Environment ) ;
1616
1717 var marketClient = builder . Services . SingleOrDefault ( x => x . ServiceType == typeof ( IMarketClient ) ) ;
1818
@@ -24,7 +24,7 @@ public void ShouldHave_Scoped_MarketClient()
2424 public void ShouldHave_Scoped_MarketService ( )
2525 {
2626 var builder = WebApplication . CreateBuilder ( ) ;
27- builder . Services . ConfigureServices ( ) ;
27+ builder . Services . ConfigureServices ( builder . Environment ) ;
2828
2929 var marketService = builder . Services . SingleOrDefault ( x => x . ServiceType == typeof ( IMarketService ) ) ;
3030
You can’t perform that action at this time.
0 commit comments