plugins/mod_debug_sql.lua
author Matthew Wild <mwild1@gmail.com>
Wed, 27 Mar 2024 15:35:15 +0000
branch0.12
changeset 13469 54a936345aaa
parent 8394 5edb0d01a94f
permissions -rw-r--r--
prosodyctl check: Warn about invalid domain names in the config file This ensures that domain names of virtual hosts and components are valid in XMPP, and that they are encoded correctly.

-- Enables SQL query logging
--
-- luacheck: ignore 213/uri

module:set_global();

local engines = module:shared("/*/sql/connections");

for uri, engine in pairs(engines) do
	engine:debug(true);
end

setmetatable(engines, {
	__newindex = function (t, uri, engine)
		engine:debug(true);
		rawset(t, uri, engine);
	end
});

function module.unload()
	setmetatable(engines, nil);
	for uri, engine in pairs(engines) do
		engine:debug(false);
	end
end