Comparison

core/configmanager.lua @ 8692:a55574754e5f

configmanager: Move firing of the 'config-reloaded' event into util.startup (fixes #1117)
author Kim Alvefur <zash@zash.se>
date Sun, 25 Mar 2018 17:02:00 +0200
parent 8555:4f0f5b49bb03
child 9241:2d82a926826f
comparison
equal deleted inserted replaced
8691:564e2c63e0d4 8692:a55574754e5f
8 8
9 local _G = _G; 9 local _G = _G;
10 local setmetatable, rawget, rawset, io, error, dofile, type, pairs = 10 local setmetatable, rawget, rawset, io, error, dofile, type, pairs =
11 setmetatable, rawget, rawset, io, error, dofile, type, pairs; 11 setmetatable, rawget, rawset, io, error, dofile, type, pairs;
12 local format, math_max = string.format, math.max; 12 local format, math_max = string.format, math.max;
13
14 local fire_event = prosody and prosody.events.fire_event or function () end;
15 13
16 local envload = require"util.envload".envload; 14 local envload = require"util.envload".envload;
17 local deps = require"util.dependencies"; 15 local deps = require"util.dependencies";
18 local resolve_relative_path = require"util.paths".resolve_relative_path; 16 local resolve_relative_path = require"util.paths".resolve_relative_path;
19 local glob_to_pattern = require"util.paths".glob_to_pattern; 17 local glob_to_pattern = require"util.paths".glob_to_pattern;
84 local new_config = setmetatable({ ["*"] = { } }, config_mt); 82 local new_config = setmetatable({ ["*"] = { } }, config_mt);
85 local ok, err = parser.load(f:read("*a"), filename, new_config); 83 local ok, err = parser.load(f:read("*a"), filename, new_config);
86 f:close(); 84 f:close();
87 if ok then 85 if ok then
88 config = new_config; 86 config = new_config;
89 fire_event("config-reloaded", {
90 filename = filename,
91 format = config_format,
92 config = config
93 });
94 end 87 end
95 return ok, "parser", err; 88 return ok, "parser", err;
96 end 89 end
97 return f, "file", err; 90 return f, "file", err;
98 end 91 end