Software /
code /
prosody-modules
File
mod_http_health/mod_http_health.lua @ 5702:e274431bf4ce
mod_http_status: Add IP allowlisting capabilities
Based on mod_http_openmetrics
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 25 Oct 2023 17:18:50 +0200 |
parent | 5690:9bcd257dea4e |
child | 5712:09233b625cb9 |
line wrap: on
line source
module:set_global(); local modulemanager = require "core.modulemanager"; module:provides("http", { route = { GET = function() for host in pairs(prosody.hosts) do local mods = modulemanager.get_modules(host); for _, mod in pairs(mods) do if mod.module.status_type == "error" then return { status_code = 500; headers = { content_type = "text/plain" }; body = "HAS ERRORS\n" }; end end end return { status_code = 200; headers = { content_type = "text/plain" }; body = "OK\n" }; end; }; });