view mod_http_health/mod_http_health.lua @ 5674:51d0311747fa

mod_storage_s3: Handle archive query without parameters
author Kim Alvefur <zash@zash.se>
date Sat, 14 Oct 2023 22:49:12 +0200
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;
	};
});