Skip to content
Snippets Groups Projects
Commit d35246c4 authored by Alexander Strizhakov's avatar Alexander Strizhakov
Browse files

added healthcheck setting to instance config

parent 20deff75
No related branches found
No related tags found
No related merge requests found
...@@ -230,7 +230,8 @@ config :pleroma, :instance, ...@@ -230,7 +230,8 @@ config :pleroma, :instance,
welcome_user_nickname: nil, welcome_user_nickname: nil,
welcome_message: nil, welcome_message: nil,
max_report_comment_size: 1000, max_report_comment_size: 1000,
safe_dm_mentions: false safe_dm_mentions: false,
healthcheck: false
config :pleroma, :markup, config :pleroma, :markup,
# XXX - unfortunately, inline images must be enabled by default right now, because # XXX - unfortunately, inline images must be enabled by default right now, because
......
...@@ -103,6 +103,7 @@ config :pleroma, Pleroma.Emails.Mailer, ...@@ -103,6 +103,7 @@ config :pleroma, Pleroma.Emails.Mailer,
* `welcome_user_nickname`: The nickname of the local user that sends the welcome message. * `welcome_user_nickname`: The nickname of the local user that sends the welcome message.
* `max_report_comment_size`: The maximum size of the report comment (Default: `1000`) * `max_report_comment_size`: The maximum size of the report comment (Default: `1000`)
* `safe_dm_mentions`: If set to true, only mentions at the beginning of a post will be used to address people in direct messages. This is to prevent accidental mentioning of people when talking about them (e.g. "@friend hey i really don't like @enemy"). (Default: `false`) * `safe_dm_mentions`: If set to true, only mentions at the beginning of a post will be used to address people in direct messages. This is to prevent accidental mentioning of people when talking about them (e.g. "@friend hey i really don't like @enemy"). (Default: `false`)
* `healthcheck`: if set to true, system data will be shown on ``/api/pleroma/healthcheck``.
## :logger ## :logger
* `backends`: `:console` is used to send logs to stdout, `{ExSyslogger, :ex_syslogger}` to log to syslog, and `Quack.Logger` to log to Slack * `backends`: `:console` is used to send logs to stdout, `{ExSyslogger, :ex_syslogger}` to log to syslog, and `Quack.Logger` to log to Slack
......
...@@ -365,10 +365,15 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do ...@@ -365,10 +365,15 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
end end
def healthcheck(conn, _params) do def healthcheck(conn, _params) do
info = Pleroma.Healthcheck.system_info() info =
if Pleroma.Config.get([:instance, :healthcheck]) do
Pleroma.Healthcheck.system_info()
else
%{}
end
conn = conn =
if info.healthy do if info[:healthy] do
conn conn
else else
Plug.Conn.put_status(conn, :service_unavailable) Plug.Conn.put_status(conn, :service_unavailable)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment