From 819a4e031d8e2b9e2257a373d01849afb347f585 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 21 May 2018 12:49:57 -0400 Subject: [PATCH] explicitly disable app insights telemetry --- src/Admin/Startup.cs | 9 ++++++--- util/Server/Startup.cs | 7 +++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Admin/Startup.cs b/src/Admin/Startup.cs index e9688ab57..8df7533d1 100644 --- a/src/Admin/Startup.cs +++ b/src/Admin/Startup.cs @@ -2,6 +2,7 @@ using Bit.Core; using Bit.Core.Identity; using Bit.Core.Utilities; +using Microsoft.ApplicationInsights.Extensibility; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Routing; @@ -72,15 +73,17 @@ namespace Bit.Admin IHostingEnvironment env, IApplicationLifetime appLifetime, GlobalSettings globalSettings, - ILoggerFactory loggerFactory) + ILoggerFactory loggerFactory, + TelemetryConfiguration telemetryConfiguration) { - loggerFactory.AddSerilog(app, env, appLifetime, globalSettings, (e) => e.Level >= LogEventLevel.Error); - if(globalSettings.SelfHosted) { app.UsePathBase("/admin"); + telemetryConfiguration.DisableTelemetry = true; } + loggerFactory.AddSerilog(app, env, appLifetime, globalSettings, (e) => e.Level >= LogEventLevel.Error); + if(env.IsDevelopment()) { app.UseDeveloperExceptionPage(); diff --git a/util/Server/Startup.cs b/util/Server/Startup.cs index 0edef5912..1e2e78754 100644 --- a/util/Server/Startup.cs +++ b/util/Server/Startup.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Builder; +using Microsoft.ApplicationInsights.Extensibility; +using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -13,8 +14,10 @@ namespace Bit.Server public void Configure( IApplicationBuilder app, ILoggerFactory loggerFactory, - IConfiguration configuration) + IConfiguration configuration, + TelemetryConfiguration telemetryConfiguration) { + telemetryConfiguration.DisableTelemetry = true; loggerFactory .AddConsole() .AddDebug();