diff options
author | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2023-09-24 22:52:41 +0200 |
---|---|---|
committer | tusooa <tusooa@kazv.moe> | 2023-12-14 20:11:01 -0500 |
commit | 35090f6eac3a4c63d52d37fe3f92b382d736b47c (patch) | |
tree | ea2c7a1c8bc87db53bb6e98b4462dc93472e7f67 /lib | |
parent | 272271d93935946ea5362d572de9a8cc3372883c (diff) | |
download | pleroma-35090f6eac3a4c63d52d37fe3f92b382d736b47c.tar.gz pleroma-35090f6eac3a4c63d52d37fe3f92b382d736b47c.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 |