view mod_http_health/mod_http_health.lua @ 5684:7c264a2cb970

mod_storage_ejabberdsql_readonly: Don't use MySQL-specific syntax util.sql should take care of transformation when MySQL is in use.
author Matthew Wild <mwild1@gmail.com>
date Mon, 30 Oct 2023 12:28:12 +0000
parents 9bcd257dea4e
children 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;
	};
});