diff options
| author | sparky8251 <sparky@possumlodge.me> | 2020-04-27 08:42:46 -0400 |
|---|---|---|
| committer | sparky8251 <sparky@possumlodge.me> | 2020-04-27 08:42:46 -0400 |
| commit | e3a42a8fe93727d43d02a9b560a53661f12230b8 (patch) | |
| tree | 5fbcec05ff6854b592ad0c2b176847e2baed1729 | |
| parent | 997b71bbefa91f7a7fd9b499cb3d2ca656de466d (diff) | |
Address reviews
| -rw-r--r-- | Emby.Server.Implementations/ApplicationHost.cs | 2 | ||||
| -rw-r--r-- | Jellyfin.Server/Migrations/Routines/DisableMetricsCollection.cs | 33 | ||||
| -rw-r--r-- | Jellyfin.Server/Startup.cs | 3 |
3 files changed, 3 insertions, 35 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 7e7b785d8..b9aaaa206 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -263,7 +263,7 @@ namespace Emby.Server.Implementations // Initialize runtime stat collection if (ServerConfigurationManager.Configuration.EnableMetrics) { - IDisposable collector = DotNetRuntimeStatsBuilder.Default().StartCollecting(); + DotNetRuntimeStatsBuilder.Default().StartCollecting(); } fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem)); diff --git a/Jellyfin.Server/Migrations/Routines/DisableMetricsCollection.cs b/Jellyfin.Server/Migrations/Routines/DisableMetricsCollection.cs deleted file mode 100644 index b5dc43614..000000000 --- a/Jellyfin.Server/Migrations/Routines/DisableMetricsCollection.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using MediaBrowser.Common.Configuration; -using MediaBrowser.Model.Configuration; -using Microsoft.Extensions.Logging; - -namespace Jellyfin.Server.Migrations.Routines -{ - /// <summary> - /// Disable metrics collections for all installations since it can be a security risk if not properly secured. - /// </summary> - internal class DisableMetricsCollection : IMigrationRoutine - { - /// <inheritdoc/> - public Guid Id => Guid.Parse("{4124C2CD-E939-4FFB-9BE9-9B311C413638}"); - - /// <inheritdoc/> - public string Name => "DisableMetricsCollection"; - - /// <inheritdoc/> - public void Perform(CoreAppHost host, ILogger logger) - { - // Set EnableMetrics to false since it can leak sensitive information if not properly secured - var metrics = host.ServerConfigurationManager.Configuration.EnableMetrics; - if (metrics) - { - logger.LogInformation("Disabling metrics collection during migration"); - metrics = false; - - host.ServerConfigurationManager.SaveConfiguration("false", metrics); - } - } - } -} diff --git a/Jellyfin.Server/Startup.cs b/Jellyfin.Server/Startup.cs index 2cc7cff87..8bcfd1350 100644 --- a/Jellyfin.Server/Startup.cs +++ b/Jellyfin.Server/Startup.cs @@ -72,7 +72,8 @@ namespace Jellyfin.Server app.UseAuthorization(); if (_serverConfigurationManager.Configuration.EnableMetrics) { - app.UseHttpMetrics(); // Must be registered after any middleware that could chagne HTTP response codes or the data will be bad + // Must be registered after any middleware that could chagne HTTP response codes or the data will be bad + app.UseHttpMetrics(); } app.UseEndpoints(endpoints => |
