btcpayserver/BTCPayServer/Controllers/GreenField/HealthController.cs
Andrew Camilleri ba165ddd4f
Local Greenfield Client for Plugins (#2410)
* wip

* Local GreenField Client for Plugins

* support notification handlers being missing

* Initial support for scoped btcpay client

* test out scoped local client

* wip

* small fix

* Throw exception if using local greenfield client and it has not been implemented yet

* adapt based on new changes in BTCPay

* update

* fix tests

* Allow Local client to bypass authorization handler

* Add Misc endpoints to Local API Client

* Add new endpoints

* Apply code review changes
2021-07-27 21:11:47 +09:00

31 lines
812 B
C#

using BTCPayServer.Client.Models;
using BTCPayServer.HostedServices;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
namespace BTCPayServer.Controllers.GreenField
{
[Controller]
[EnableCors(CorsPolicies.All)]
public class HealthController : ControllerBase
{
private readonly NBXplorerDashboard _dashBoard;
public HealthController(NBXplorerDashboard dashBoard )
{
_dashBoard = dashBoard;
}
[AllowAnonymous]
[HttpGet("~/api/v1/health")]
public ActionResult GetHealth()
{
ApiHealthData model = new ApiHealthData()
{
Synchronized = _dashBoard.IsFullySynched()
};
return Ok(model);
}
}
}