added /system/status end point that returns environment information.

pull/3113/head
kay.one 12 years ago
parent a0162d52f9
commit a36216c73c

@ -150,6 +150,7 @@
<Compile Include="SignalR\Serializer.cs" />
<Compile Include="SignalR\SignalrDependencyResolver.cs" />
<Compile Include="SignalR\NzbDronePersistentConnection.cs" />
<Compile Include="System\SystemModule.cs" />
<Compile Include="TinyIoCNancyBootstrapper.cs" />
<Compile Include="Update\UpdateModule.cs" />
<Compile Include="Validation\IdValidationRule.cs" />

@ -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 @@ namespace NzbDrone.Common
var service = ServiceController.GetServices()
.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)

Loading…
Cancel
Save