defmodule VigilWeb.Api.V0.HeartbeatController do
@moduledoc """
`POST /api/0/organizations/{org}/heartbeat_check/{token}/` (GlitchTip's
path; GET too, for a bare `curl`): a heartbeat monitor's ping. No API
token: the secret token in the URL is the credential. Answers the
check in GlitchTip's shape, or 404.
"""
use VigilWeb, :controller
alias VigilWeb.Api.Auth
def create(conn, %{"org" => org, "token" => token}) do
case Vigil.Uptime.heartbeat(org, token) do
{:ok, monitor} ->
json(conn, %{isUp: true, startCheck: monitor.last_check_at, reason: nil})
:error ->
Auth.not_found(conn)
end
end
end
neiam
/vigil
public · Issues · Pulls · Labels · Forks · Compare · Actions queued · Badges · Packages
⭐
Log in to mark this repository.
654 B · text
History
573fef1