mod_console: Add config:reload() command

Sat, 18 Jul 2009 15:34:36 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 18 Jul 2009 15:34:36 +0100
changeset 1558
e15917530285
parent 1557
64837ed2d112
child 1559
831649bb1922

mod_console: Add config:reload() command

plugins/mod_console.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_console.lua	Sat Jul 18 15:33:16 2009 +0100
+++ b/plugins/mod_console.lua	Sat Jul 18 15:34:36 2009 +0100
@@ -160,6 +160,7 @@
 -- Anything in def_env will be accessible within the session as a global variable
 
 def_env.server = {};
+
 function def_env.server:insane_reload()
 	prosody.unlock_globals();
 	dofile "prosody"
@@ -288,6 +289,11 @@
 	return true, tostring(config_get(host, section, key));
 end
 
+function def_env.config:reload()
+	local ok, err = prosody.reload_config();
+	return ok, (ok and "Config reloaded (you may need to reload modules to take effect)") or tostring(err);
+end
+
 def_env.hosts = {};
 function def_env.hosts:list()
 	for host, host_session in pairs(hosts) do

mercurial