prosody

changeset 2428
3ba9db4b9311
parent 2365
0bd8408a491c
child 2429
5cfa1400e247
equal deleted inserted replaced
2427:343a9eb7540e 2428:3ba9db4b9311
62 -- Define the functions we call during startup, the 62 -- Define the functions we call during startup, the
63 -- actual startup happens right at the end, where these 63 -- actual startup happens right at the end, where these
64 -- functions get called 64 -- functions get called
65 65
66 function read_config() 66 function read_config()
67 -- TODO: Check for other formats when we add support for them
68 -- Use lfs? Make a new conf/ dir?
69 local filenames = {}; 67 local filenames = {};
70 68
71 local filename; 69 local filename;
72 if arg[1] == "--config" and arg[2] then 70 if arg[1] == "--config" and arg[2] then
73 table.insert(filenames, arg[2]); 71 table.insert(filenames, arg[2]);
74 if CFG_CONFIGDIR then 72 if CFG_CONFIGDIR then
75 table.insert(filenames, CFG_CONFIGDIR.."/"..arg[2]); 73 table.insert(filenames, CFG_CONFIGDIR.."/"..arg[2]);
76 end 74 end
77 else 75 else
78 table.insert(filenames, (CFG_CONFIGDIR or ".").."/prosody.cfg.lua"); 76 for _, format in ipairs(config.parsers()) do
77 table.insert(filenames, (CFG_CONFIGDIR or ".").."/prosody.cfg."..format);
78 end
79 end 79 end
80 for _,_filename in ipairs(filenames) do 80 for _,_filename in ipairs(filenames) do
81 filename = _filename; 81 filename = _filename;
82 local file = io.open(filename); 82 local file = io.open(filename);
83 if file then 83 if file then

mercurial