plugins/mod_console.lua

changeset 1558
e15917530285
parent 1556
8154aa1fbe6c
child 1559
831649bb1922
equal deleted inserted replaced
1557:64837ed2d112 1558:e15917530285
158 158
159 -- Session environment -- 159 -- Session environment --
160 -- Anything in def_env will be accessible within the session as a global variable 160 -- Anything in def_env will be accessible within the session as a global variable
161 161
162 def_env.server = {}; 162 def_env.server = {};
163
163 function def_env.server:insane_reload() 164 function def_env.server:insane_reload()
164 prosody.unlock_globals(); 165 prosody.unlock_globals();
165 dofile "prosody" 166 dofile "prosody"
166 prosody = _G.prosody; 167 prosody = _G.prosody;
167 return true, "Server reloaded"; 168 return true, "Server reloaded";
284 end 285 end
285 286
286 function def_env.config:get(host, section, key) 287 function def_env.config:get(host, section, key)
287 local config_get = require "core.configmanager".get 288 local config_get = require "core.configmanager".get
288 return true, tostring(config_get(host, section, key)); 289 return true, tostring(config_get(host, section, key));
290 end
291
292 function def_env.config:reload()
293 local ok, err = prosody.reload_config();
294 return ok, (ok and "Config reloaded (you may need to reload modules to take effect)") or tostring(err);
289 end 295 end
290 296
291 def_env.hosts = {}; 297 def_env.hosts = {};
292 function def_env.hosts:list() 298 function def_env.hosts:list()
293 for host, host_session in pairs(hosts) do 299 for host, host_session in pairs(hosts) do

mercurial