diff options
author | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2023-09-24 22:52:41 +0200 |
---|---|---|
committer | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2023-09-24 23:32:17 +0200 |
commit | 2f6fc6a7ab0e757abfe9ec535842a12b887d2fe6 (patch) | |
tree | 5adc828d4d0d21c4e5063ab6ccb70a2f9ca1d039 /lib | |
parent | a94cf2ad4ff523f72d03a9bf76ca9ec6b242c79b (diff) | |
download | pleroma-2f6fc6a7ab0e757abfe9ec535842a12b887d2fe6.tar.gz pleroma-2f6fc6a7ab0e757abfe9ec535842a12b887d2fe6.zip |
TwitterAPI: Return proper error when healthcheck is disabled
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/twitter_api/controllers/util_controller.ex | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/pleroma/web/twitter_api/controllers/util_controller.ex b/lib/pleroma/web/twitter_api/controllers/util_controller.ex index d5a24ae6c..ca8a98960 100644 --- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex +++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex @@ -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 |