mirror of
https://github.com/Radarr/Radarr
synced 2024-12-26 09:49:00 +00:00
added /system/status end point that returns environment information.
This commit is contained in:
parent
a0162d52f9
commit
a36216c73c
3 changed files with 39 additions and 1 deletions
|
@ -150,6 +150,7 @@
|
||||||
<Compile Include="SignalR\Serializer.cs" />
|
<Compile Include="SignalR\Serializer.cs" />
|
||||||
<Compile Include="SignalR\SignalrDependencyResolver.cs" />
|
<Compile Include="SignalR\SignalrDependencyResolver.cs" />
|
||||||
<Compile Include="SignalR\NzbDronePersistentConnection.cs" />
|
<Compile Include="SignalR\NzbDronePersistentConnection.cs" />
|
||||||
|
<Compile Include="System\SystemModule.cs" />
|
||||||
<Compile Include="TinyIoCNancyBootstrapper.cs" />
|
<Compile Include="TinyIoCNancyBootstrapper.cs" />
|
||||||
<Compile Include="Update\UpdateModule.cs" />
|
<Compile Include="Update\UpdateModule.cs" />
|
||||||
<Compile Include="Validation\IdValidationRule.cs" />
|
<Compile Include="Validation\IdValidationRule.cs" />
|
||||||
|
|
37
NzbDrone.Api/System/SystemModule.cs
Normal file
37
NzbDrone.Api/System/SystemModule.cs
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
using Nancy;
|
||||||
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Api.Extensions;
|
||||||
|
|
||||||
|
namespace NzbDrone.Api.System
|
||||||
|
{
|
||||||
|
public class SystemModule : NzbDroneApiModule
|
||||||
|
{
|
||||||
|
private readonly IEnvironmentProvider _environmentProvider;
|
||||||
|
|
||||||
|
public SystemModule(IEnvironmentProvider environmentProvider)
|
||||||
|
: base("system")
|
||||||
|
{
|
||||||
|
_environmentProvider = environmentProvider;
|
||||||
|
Get["/status"] = x => GetStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Response GetStatus()
|
||||||
|
{
|
||||||
|
return new
|
||||||
|
{
|
||||||
|
Version = _environmentProvider.Version,
|
||||||
|
AppData = _environmentProvider.GetAppDataPath(),
|
||||||
|
IsAdmin = _environmentProvider.IsAdmin,
|
||||||
|
IsUserInteractive = _environmentProvider.IsUserInteractive,
|
||||||
|
BuildTime = _environmentProvider.BuildDateTime,
|
||||||
|
StartupPath = _environmentProvider.StartUpPath,
|
||||||
|
OsVersion = _environmentProvider.GetOsVersion(),
|
||||||
|
IsMono = EnvironmentProvider.IsMono,
|
||||||
|
IsProduction = EnvironmentProvider.IsProduction,
|
||||||
|
IsDebug = EnvironmentProvider.IsDebug,
|
||||||
|
IsLinux = EnvironmentProvider.IsLinux
|
||||||
|
}.AsResponse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -41,7 +41,7 @@ public virtual bool IsServiceRunning(string name)
|
||||||
var service = ServiceController.GetServices()
|
var service = ServiceController.GetServices()
|
||||||
.SingleOrDefault(s => String.Equals(s.ServiceName, name, StringComparison.InvariantCultureIgnoreCase));
|
.SingleOrDefault(s => String.Equals(s.ServiceName, name, StringComparison.InvariantCultureIgnoreCase));
|
||||||
|
|
||||||
return service != null && service.Status == ServiceControllerStatus.Running;
|
return service != null && (service.Status == ServiceControllerStatus.Running || service.Status == ServiceControllerStatus.StartPending);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Install(string serviceName)
|
public virtual void Install(string serviceName)
|
||||||
|
|
Loading…
Reference in a new issue