You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
987 B
40 lines
987 B
2 years ago
|
using System;
|
||
|
using Microsoft.AspNetCore.Http;
|
||
|
using Microsoft.AspNetCore.Mvc;
|
||
|
using NzbDrone.Core.Configuration;
|
||
|
|
||
|
namespace Lidarr.Http.Ping
|
||
|
{
|
||
|
public class PingController : Controller
|
||
|
{
|
||
|
private readonly IConfigRepository _configRepository;
|
||
|
|
||
|
public PingController(IConfigRepository configRepository)
|
||
|
{
|
||
|
_configRepository = configRepository;
|
||
|
}
|
||
|
|
||
|
[HttpGet("/ping")]
|
||
|
[Produces("application/json")]
|
||
|
public ActionResult<PingResource> GetStatus()
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
_configRepository.All();
|
||
|
}
|
||
|
catch (Exception)
|
||
|
{
|
||
|
return StatusCode(StatusCodes.Status500InternalServerError, new PingResource
|
||
|
{
|
||
|
Status = "Error"
|
||
|
});
|
||
|
}
|
||
|
|
||
|
return StatusCode(StatusCodes.Status200OK, new PingResource
|
||
|
{
|
||
|
Status = "OK"
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|