TwitterAPI: Return proper error when healthcheck is disabled
This commit is contained in:
parent
272271d939
commit
35090f6eac
3 changed files with 6 additions and 2 deletions
|
|
@ -345,13 +345,16 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
|
|||
end
|
||||
|
||||
def healthcheck(conn, _params) do
|
||||
with true <- Config.get([:instance, :healthcheck]),
|
||||
with {:cfg, true} <- {:cfg, Config.get([:instance, :healthcheck])},
|
||||
%{healthy: true} = info <- Healthcheck.system_info() do
|
||||
json(conn, info)
|
||||
else
|
||||
%{healthy: false} = info ->
|
||||
service_unavailable(conn, info)
|
||||
|
||||
{:cfg, false} ->
|
||||
service_unavailable(conn, %{"error" => "Healthcheck disabled"})
|
||||
|
||||
_ ->
|
||||
service_unavailable(conn, %{})
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue