mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
Updated way Sentry gets configured and enabled.
This commit is contained in:
parent
ec4237d51a
commit
332466a945
12 changed files with 177 additions and 83 deletions
|
@ -90,10 +90,6 @@ namespace NzbDrone.Common.EnvironmentInfo
|
||||||
{
|
{
|
||||||
IsDocker = true;
|
IsDocker = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Environment.SetEnvironmentVariable("OS_NAME", Name);
|
|
||||||
Environment.SetEnvironmentVariable("OS_VERSION", Version);
|
|
||||||
Environment.SetEnvironmentVariable("OS_IS_DOCKER", IsDocker.ToString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,16 @@ namespace NzbDrone.Common.EnvironmentInfo
|
||||||
|
|
||||||
static RuntimeInfo()
|
static RuntimeInfo()
|
||||||
{
|
{
|
||||||
IsProduction = InternalIsProduction();
|
var officialBuild = InternalIsOfficialBuild();
|
||||||
|
|
||||||
|
// An build running inside of the testing environment. (Analytics disabled)
|
||||||
|
IsTesting = InternalIsTesting();
|
||||||
|
|
||||||
|
// An official build running outside of the testing environment. (Analytics configurable)
|
||||||
|
IsProduction = !IsTesting && officialBuild;
|
||||||
|
|
||||||
|
// An unofficial build running outside of the testing environment. (Analytics enabled)
|
||||||
|
IsDevelopment = !IsTesting && !officialBuild && !InternalIsDebug();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime StartTime
|
public DateTime StartTime
|
||||||
|
@ -108,23 +117,21 @@ namespace NzbDrone.Common.EnvironmentInfo
|
||||||
public bool RestartPending { get; set; }
|
public bool RestartPending { get; set; }
|
||||||
public string ExecutingApplication { get; }
|
public string ExecutingApplication { get; }
|
||||||
|
|
||||||
|
public static bool IsTesting { get; }
|
||||||
public static bool IsProduction { get; }
|
public static bool IsProduction { get; }
|
||||||
|
public static bool IsDevelopment { get; }
|
||||||
|
|
||||||
private static bool InternalIsProduction()
|
|
||||||
|
private static bool InternalIsTesting()
|
||||||
{
|
{
|
||||||
if (BuildInfo.IsDebug || Debugger.IsAttached) return false;
|
|
||||||
|
|
||||||
//Official builds will never have such a high revision
|
|
||||||
if (BuildInfo.Version.Revision > 10000) return false;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var lowerProcessName = Process.GetCurrentProcess().ProcessName.ToLower();
|
var lowerProcessName = Process.GetCurrentProcess().ProcessName.ToLower();
|
||||||
|
|
||||||
if (lowerProcessName.Contains("vshost")) return false;
|
if (lowerProcessName.Contains("vshost")) return true;
|
||||||
if (lowerProcessName.Contains("nunit")) return false;
|
if (lowerProcessName.Contains("nunit")) return true;
|
||||||
if (lowerProcessName.Contains("jetbrain")) return false;
|
if (lowerProcessName.Contains("jetbrain")) return true;
|
||||||
if (lowerProcessName.Contains("resharper")) return false;
|
if (lowerProcessName.Contains("resharper")) return true;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -134,7 +141,7 @@ namespace NzbDrone.Common.EnvironmentInfo
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var currentAssemblyLocation = typeof(RuntimeInfo).Assembly.Location;
|
var currentAssemblyLocation = typeof(RuntimeInfo).Assembly.Location;
|
||||||
if (currentAssemblyLocation.ToLower().Contains("_output")) return false;
|
if (currentAssemblyLocation.ToLower().Contains("_output")) return true;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -142,9 +149,24 @@ namespace NzbDrone.Common.EnvironmentInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
var lowerCurrentDir = Directory.GetCurrentDirectory().ToLower();
|
var lowerCurrentDir = Directory.GetCurrentDirectory().ToLower();
|
||||||
if (lowerCurrentDir.Contains("vsts")) return false;
|
if (lowerCurrentDir.Contains("vsts")) return true;
|
||||||
if (lowerCurrentDir.Contains("buildagent")) return false;
|
if (lowerCurrentDir.Contains("buildagent")) return true;
|
||||||
if (lowerCurrentDir.Contains("_output")) return false;
|
if (lowerCurrentDir.Contains("_output")) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool InternalIsDebug()
|
||||||
|
{
|
||||||
|
if (BuildInfo.IsDebug || Debugger.IsAttached) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool InternalIsOfficialBuild()
|
||||||
|
{
|
||||||
|
//Official builds will never have such a high revision
|
||||||
|
if (BuildInfo.Version.Major >= 10 || BuildInfo.Version.Revision > 10000) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
28
src/NzbDrone.Common/Instrumentation/InitializeLogger.cs
Normal file
28
src/NzbDrone.Common/Instrumentation/InitializeLogger.cs
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
using System.Linq;
|
||||||
|
using NLog;
|
||||||
|
using NLog.Fluent;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
|
using NzbDrone.Common.Instrumentation.Extensions;
|
||||||
|
using NzbDrone.Common.Instrumentation.Sentry;
|
||||||
|
|
||||||
|
namespace NzbDrone.Common.Instrumentation
|
||||||
|
{
|
||||||
|
public class InitializeLogger
|
||||||
|
{
|
||||||
|
private readonly IOsInfo _osInfo;
|
||||||
|
|
||||||
|
public InitializeLogger(IOsInfo osInfo)
|
||||||
|
{
|
||||||
|
_osInfo = osInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialize()
|
||||||
|
{
|
||||||
|
var sentryTarget = LogManager.Configuration.AllTargets.OfType<SentryTarget>().FirstOrDefault();
|
||||||
|
if (sentryTarget != null)
|
||||||
|
{
|
||||||
|
sentryTarget.UpdateScope(_osInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -58,18 +58,6 @@ namespace NzbDrone.Common.Instrumentation
|
||||||
LogManager.ReconfigExistingLoggers();
|
LogManager.ReconfigExistingLoggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UnRegisterRemoteLoggers()
|
|
||||||
{
|
|
||||||
var sentryRules = LogManager.Configuration.LoggingRules.Where(r => r.Targets.Any(t => t.Name == "sentryTarget"));
|
|
||||||
|
|
||||||
foreach (var rules in sentryRules)
|
|
||||||
{
|
|
||||||
rules.Targets.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
LogManager.ReconfigExistingLoggers();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void RegisterSentry(bool updateClient)
|
private static void RegisterSentry(bool updateClient)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ using NLog;
|
||||||
using NLog.Common;
|
using NLog.Common;
|
||||||
using NLog.Targets;
|
using NLog.Targets;
|
||||||
using NzbDrone.Common.EnvironmentInfo;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
|
using NzbDrone.Common.Extensions;
|
||||||
using Sentry;
|
using Sentry;
|
||||||
using Sentry.Protocol;
|
using Sentry.Protocol;
|
||||||
|
|
||||||
|
@ -77,6 +78,7 @@ namespace NzbDrone.Common.Instrumentation.Sentry
|
||||||
{LogLevel.Warn, BreadcrumbLevel.Warning},
|
{LogLevel.Warn, BreadcrumbLevel.Warning},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private readonly DateTime _startTime = DateTime.UtcNow;
|
||||||
private readonly IDisposable _sdk;
|
private readonly IDisposable _sdk;
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
|
|
||||||
|
@ -84,9 +86,7 @@ namespace NzbDrone.Common.Instrumentation.Sentry
|
||||||
private bool _unauthorized;
|
private bool _unauthorized;
|
||||||
|
|
||||||
public bool FilterEvents { get; set; }
|
public bool FilterEvents { get; set; }
|
||||||
public string UpdateBranch { get; set; }
|
public bool SentryEnabled { get; set; }
|
||||||
public Version DatabaseVersion { get; set; }
|
|
||||||
public int DatabaseMigration { get; set; }
|
|
||||||
|
|
||||||
public SentryTarget(string dsn)
|
public SentryTarget(string dsn)
|
||||||
{
|
{
|
||||||
|
@ -95,27 +95,22 @@ namespace NzbDrone.Common.Instrumentation.Sentry
|
||||||
o.Dsn = new Dsn(dsn);
|
o.Dsn = new Dsn(dsn);
|
||||||
o.AttachStacktrace = true;
|
o.AttachStacktrace = true;
|
||||||
o.MaxBreadcrumbs = 200;
|
o.MaxBreadcrumbs = 200;
|
||||||
o.SendDefaultPii = true;
|
o.SendDefaultPii = false;
|
||||||
o.Debug = false;
|
o.Debug = false;
|
||||||
o.DiagnosticsLevel = SentryLevel.Debug;
|
o.DiagnosticsLevel = SentryLevel.Debug;
|
||||||
o.Release = BuildInfo.Release;
|
o.Release = BuildInfo.Release;
|
||||||
|
if (PlatformInfo.IsMono)
|
||||||
|
{
|
||||||
|
// Mono 6.0 broke GzipStream.WriteAsync
|
||||||
|
// TODO: Check specific version
|
||||||
|
o.RequestBodyCompressionLevel = System.IO.Compression.CompressionLevel.NoCompression;
|
||||||
|
}
|
||||||
o.BeforeSend = x => SentryCleanser.CleanseEvent(x);
|
o.BeforeSend = x => SentryCleanser.CleanseEvent(x);
|
||||||
o.BeforeBreadcrumb = x => SentryCleanser.CleanseBreadcrumb(x);
|
o.BeforeBreadcrumb = x => SentryCleanser.CleanseBreadcrumb(x);
|
||||||
|
o.Environment = BuildInfo.Branch;
|
||||||
});
|
});
|
||||||
|
|
||||||
SentrySdk.ConfigureScope(scope =>
|
InitializeScope();
|
||||||
{
|
|
||||||
scope.User = new User {
|
|
||||||
Username = HashUtil.AnonymousToken()
|
|
||||||
};
|
|
||||||
|
|
||||||
scope.SetTag("osfamily", OsInfo.Os.ToString());
|
|
||||||
scope.SetTag("runtime", PlatformInfo.PlatformName);
|
|
||||||
scope.SetTag("culture", Thread.CurrentThread.CurrentCulture.Name);
|
|
||||||
scope.SetTag("branch", BuildInfo.Branch);
|
|
||||||
scope.SetTag("version", BuildInfo.Version.ToString());
|
|
||||||
scope.SetTag("production", RuntimeInfo.IsProduction.ToString());
|
|
||||||
});
|
|
||||||
|
|
||||||
_debounce = new SentryDebounce();
|
_debounce = new SentryDebounce();
|
||||||
|
|
||||||
|
@ -123,6 +118,58 @@ namespace NzbDrone.Common.Instrumentation.Sentry
|
||||||
// Otherwise it will default to false and any errors occuring
|
// Otherwise it will default to false and any errors occuring
|
||||||
// before config file gets read will not be filtered
|
// before config file gets read will not be filtered
|
||||||
FilterEvents = true;
|
FilterEvents = true;
|
||||||
|
SentryEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitializeScope()
|
||||||
|
{
|
||||||
|
SentrySdk.ConfigureScope(scope =>
|
||||||
|
{
|
||||||
|
scope.User = new User
|
||||||
|
{
|
||||||
|
Id = HashUtil.AnonymousToken()
|
||||||
|
};
|
||||||
|
|
||||||
|
scope.Contexts.App.Name = BuildInfo.AppName;
|
||||||
|
scope.Contexts.App.Version = BuildInfo.Version.ToString();
|
||||||
|
scope.Contexts.App.StartTime = _startTime;
|
||||||
|
scope.Contexts.App.Hash = HashUtil.AnonymousToken();
|
||||||
|
scope.Contexts.App.Build = BuildInfo.Release; // Git commit cache?
|
||||||
|
|
||||||
|
scope.SetTag("culture", Thread.CurrentThread.CurrentCulture.Name);
|
||||||
|
scope.SetTag("branch", BuildInfo.Branch);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateScope(IOsInfo osInfo)
|
||||||
|
{
|
||||||
|
SentrySdk.ConfigureScope(scope =>
|
||||||
|
{
|
||||||
|
scope.SetTag("is_docker", $"{osInfo.IsDocker}");
|
||||||
|
|
||||||
|
if (osInfo.Name != null && PlatformInfo.IsMono)
|
||||||
|
{
|
||||||
|
// Sentry auto-detection of non-Windows platforms isn't that accurate on certain devices.
|
||||||
|
scope.Contexts.OperatingSystem.Name = osInfo.Name.FirstCharToUpper();
|
||||||
|
scope.Contexts.OperatingSystem.RawDescription = osInfo.FullName;
|
||||||
|
scope.Contexts.OperatingSystem.Version = osInfo.Version.ToString();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateScope(Version databaseVersion, int migration, string updateBranch, IPlatformInfo platformInfo)
|
||||||
|
{
|
||||||
|
SentrySdk.ConfigureScope(scope =>
|
||||||
|
{
|
||||||
|
scope.Environment = updateBranch;
|
||||||
|
scope.SetTag("runtime_version", $"{PlatformInfo.PlatformName} {platformInfo.Version}");
|
||||||
|
|
||||||
|
if (databaseVersion != default(Version))
|
||||||
|
{
|
||||||
|
scope.SetTag("sqlite_version", $"{databaseVersion}");
|
||||||
|
scope.SetTag("database_migration", $"{migration}");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnError(Exception ex)
|
private void OnError(Exception ex)
|
||||||
|
@ -213,7 +260,7 @@ namespace NzbDrone.Common.Instrumentation.Sentry
|
||||||
|
|
||||||
protected override void Write(LogEventInfo logEvent)
|
protected override void Write(LogEventInfo logEvent)
|
||||||
{
|
{
|
||||||
if (_unauthorized)
|
if (_unauthorized || !SentryEnabled)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -249,27 +296,12 @@ namespace NzbDrone.Common.Instrumentation.Sentry
|
||||||
{
|
{
|
||||||
Level = LoggingLevelMap[logEvent.Level],
|
Level = LoggingLevelMap[logEvent.Level],
|
||||||
Logger = logEvent.LoggerName,
|
Logger = logEvent.LoggerName,
|
||||||
Message = logEvent.FormattedMessage,
|
Message = logEvent.FormattedMessage
|
||||||
Environment = UpdateBranch
|
|
||||||
};
|
};
|
||||||
|
|
||||||
sentryEvent.SetExtras(extras);
|
sentryEvent.SetExtras(extras);
|
||||||
sentryEvent.SetFingerprint(fingerPrint);
|
sentryEvent.SetFingerprint(fingerPrint);
|
||||||
|
|
||||||
// this can't be in the constructor as at that point OsInfo won't have
|
|
||||||
// populated these values yet
|
|
||||||
var osName = Environment.GetEnvironmentVariable("OS_NAME");
|
|
||||||
var osVersion = Environment.GetEnvironmentVariable("OS_VERSION");
|
|
||||||
var isDocker = Environment.GetEnvironmentVariable("OS_IS_DOCKER");
|
|
||||||
var runTimeVersion = Environment.GetEnvironmentVariable("RUNTIME_VERSION");
|
|
||||||
|
|
||||||
sentryEvent.SetTag("os_name", osName);
|
|
||||||
sentryEvent.SetTag("os_version", $"{osName} {osVersion}");
|
|
||||||
sentryEvent.SetTag("is_docker", isDocker);
|
|
||||||
sentryEvent.SetTag("runtime_version", $"{PlatformInfo.PlatformName} {runTimeVersion}");
|
|
||||||
sentryEvent.SetTag("sqlite_version", $"{DatabaseVersion}");
|
|
||||||
sentryEvent.SetTag("database_migration", $"{DatabaseMigration}");
|
|
||||||
|
|
||||||
SentrySdk.CaptureEvent(sentryEvent);
|
SentrySdk.CaptureEvent(sentryEvent);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
|
@ -376,11 +376,6 @@ namespace NzbDrone.Core.Configuration
|
||||||
{
|
{
|
||||||
EnsureDefaultConfigFile();
|
EnsureDefaultConfigFile();
|
||||||
DeleteOldValues();
|
DeleteOldValues();
|
||||||
|
|
||||||
if (!AnalyticsEnabled)
|
|
||||||
{
|
|
||||||
NzbDroneLogger.UnRegisterRemoteLoggers();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Execute(ResetApiKeyCommand message)
|
public void Execute(ResetApiKeyCommand message)
|
||||||
|
|
|
@ -2,7 +2,9 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NLog.Config;
|
using NLog.Config;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
|
using NzbDrone.Common.Instrumentation.Sentry;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Configuration.Events;
|
using NzbDrone.Core.Configuration.Events;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
|
@ -40,6 +42,9 @@ namespace NzbDrone.Core.Instrumentation
|
||||||
SetMinimumLogLevel(rules, "appFileDebug", minimumLogLevel <= LogLevel.Debug ? LogLevel.Debug : LogLevel.Off);
|
SetMinimumLogLevel(rules, "appFileDebug", minimumLogLevel <= LogLevel.Debug ? LogLevel.Debug : LogLevel.Off);
|
||||||
SetMinimumLogLevel(rules, "appFileTrace", minimumLogLevel <= LogLevel.Trace ? LogLevel.Trace : LogLevel.Off);
|
SetMinimumLogLevel(rules, "appFileTrace", minimumLogLevel <= LogLevel.Trace ? LogLevel.Trace : LogLevel.Off);
|
||||||
|
|
||||||
|
//Sentry
|
||||||
|
ReconfigureSentry();
|
||||||
|
|
||||||
LogManager.ReconfigExistingLoggers();
|
LogManager.ReconfigExistingLoggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +72,16 @@ namespace NzbDrone.Core.Instrumentation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ReconfigureSentry()
|
||||||
|
{
|
||||||
|
var sentryTarget = LogManager.Configuration.AllTargets.OfType<SentryTarget>().FirstOrDefault();
|
||||||
|
if (sentryTarget != null)
|
||||||
|
{
|
||||||
|
sentryTarget.SentryEnabled = RuntimeInfo.IsProduction && _configFileProvider.AnalyticsEnabled || RuntimeInfo.IsDevelopment;
|
||||||
|
sentryTarget.FilterEvents = _configFileProvider.FilterSentryEvents;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private List<LogLevel> GetLogLevels()
|
private List<LogLevel> GetLogLevels()
|
||||||
{
|
{
|
||||||
return new List<LogLevel>
|
return new List<LogLevel>
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Instrumentation.Sentry;
|
using NzbDrone.Common.Instrumentation.Sentry;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
|
@ -10,25 +12,26 @@ namespace NzbDrone.Core.Instrumentation
|
||||||
public class ReconfigureSentry : IHandleAsync<ApplicationStartedEvent>
|
public class ReconfigureSentry : IHandleAsync<ApplicationStartedEvent>
|
||||||
{
|
{
|
||||||
private readonly IConfigFileProvider _configFileProvider;
|
private readonly IConfigFileProvider _configFileProvider;
|
||||||
|
private readonly IPlatformInfo _platformInfo;
|
||||||
private readonly IMainDatabase _database;
|
private readonly IMainDatabase _database;
|
||||||
|
|
||||||
public ReconfigureSentry(IConfigFileProvider configFileProvider,
|
public ReconfigureSentry(IConfigFileProvider configFileProvider,
|
||||||
IMainDatabase database)
|
IPlatformInfo platformInfo,
|
||||||
|
IMainDatabase database)
|
||||||
{
|
{
|
||||||
_configFileProvider = configFileProvider;
|
_configFileProvider = configFileProvider;
|
||||||
|
_platformInfo = platformInfo;
|
||||||
_database = database;
|
_database = database;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reconfigure()
|
public void Reconfigure()
|
||||||
{
|
{
|
||||||
// Extended sentry config
|
// Extended sentry config
|
||||||
var sentry = LogManager.Configuration.FindTargetByName<SentryTarget>("sentryTarget");
|
var sentryTarget = LogManager.Configuration.AllTargets.OfType<SentryTarget>().FirstOrDefault();
|
||||||
sentry.FilterEvents = _configFileProvider.FilterSentryEvents;
|
if (sentryTarget != null)
|
||||||
sentry.UpdateBranch = _configFileProvider.Branch;
|
{
|
||||||
sentry.DatabaseVersion = _database.Version;
|
sentryTarget.UpdateScope(_database.Version, _database.Migration, _configFileProvider.Branch, _platformInfo);
|
||||||
sentry.DatabaseMigration = _database.Migration;
|
}
|
||||||
|
|
||||||
LogManager.ReconfigExistingLoggers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleAsync(ApplicationStartedEvent message)
|
public void HandleAsync(ApplicationStartedEvent message)
|
||||||
|
|
|
@ -36,6 +36,7 @@ namespace NzbDrone.Host
|
||||||
LongPathSupport.Enable();
|
LongPathSupport.Enable();
|
||||||
|
|
||||||
_container = MainAppContainerBuilder.BuildContainer(startupContext);
|
_container = MainAppContainerBuilder.BuildContainer(startupContext);
|
||||||
|
_container.Resolve<InitializeLogger>().Initialize();
|
||||||
_container.Resolve<IAppFolderFactory>().Register();
|
_container.Resolve<IAppFolderFactory>().Register();
|
||||||
_container.Resolve<IProvidePidFile>().Write();
|
_container.Resolve<IProvidePidFile>().Write();
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ namespace NzbDrone.Mono.EnvironmentInfo
|
||||||
if (versionMatch.Success)
|
if (versionMatch.Success)
|
||||||
{
|
{
|
||||||
runTimeVersion = new Version(versionMatch.Groups["version"].Value);
|
runTimeVersion = new Version(versionMatch.Groups["version"].Value);
|
||||||
Environment.SetEnvironmentVariable("RUNTIME_VERSION", runTimeVersion.ToString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace NzbDrone.Update
|
||||||
Logger.Info("Starting Lidarr Update Client");
|
Logger.Info("Starting Lidarr Update Client");
|
||||||
|
|
||||||
_container = UpdateContainerBuilder.Build(startupContext);
|
_container = UpdateContainerBuilder.Build(startupContext);
|
||||||
|
_container.Resolve<InitializeLogger>().Initialize();
|
||||||
_container.Resolve<UpdateApp>().Start(args);
|
_container.Resolve<UpdateApp>().Start(args);
|
||||||
|
|
||||||
Logger.Info("Update completed successfully");
|
Logger.Info("Update completed successfully");
|
||||||
|
|
|
@ -13,7 +13,6 @@ namespace NzbDrone.Windows.EnvironmentInfo
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
var version = GetFrameworkVersion();
|
var version = GetFrameworkVersion();
|
||||||
Environment.SetEnvironmentVariable("RUNTIME_VERSION", version.ToString());
|
|
||||||
Version = version;
|
Version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +32,22 @@ namespace NzbDrone.Windows.EnvironmentInfo
|
||||||
|
|
||||||
var releaseKey = (int)ndpKey.GetValue("Release");
|
var releaseKey = (int)ndpKey.GetValue("Release");
|
||||||
|
|
||||||
|
if (releaseKey >= 528040)
|
||||||
|
{
|
||||||
|
return new Version(4, 8, 0);
|
||||||
|
}
|
||||||
|
if (releaseKey >= 461808)
|
||||||
|
{
|
||||||
|
return new Version(4, 7, 2);
|
||||||
|
}
|
||||||
|
if (releaseKey >= 461308)
|
||||||
|
{
|
||||||
|
return new Version(4, 7, 1);
|
||||||
|
}
|
||||||
|
if (releaseKey >= 460798)
|
||||||
|
{
|
||||||
|
return new Version(4, 7);
|
||||||
|
}
|
||||||
if (releaseKey >= 394802)
|
if (releaseKey >= 394802)
|
||||||
{
|
{
|
||||||
return new Version(4, 6, 2);
|
return new Version(4, 6, 2);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue