32 end |
32 end |
33 |
33 |
34 -- Global 'prosody' object |
34 -- Global 'prosody' object |
35 prosody = { events = require "util.events".new(); }; |
35 prosody = { events = require "util.events".new(); }; |
36 local prosody = prosody; |
36 local prosody = prosody; |
|
37 |
|
38 -- Check dependencies |
|
39 local dependencies = require "util.dependencies"; |
|
40 if not dependencies.check_dependencies() then |
|
41 os.exit(1); |
|
42 end |
37 |
43 |
38 -- Load the config-parsing module |
44 -- Load the config-parsing module |
39 config = require "core.configmanager" |
45 config = require "core.configmanager" |
40 |
46 |
41 -- -- -- -- |
47 -- -- -- -- |
97 function init_logging() |
103 function init_logging() |
98 -- Initialize logging |
104 -- Initialize logging |
99 require "core.loggingmanager" |
105 require "core.loggingmanager" |
100 end |
106 end |
101 |
107 |
102 function check_dependencies() |
108 function log_dependency_warnings() |
103 -- Check runtime dependencies |
109 dependencies.log_warnings(); |
104 if not require "util.dependencies".check_dependencies() then |
|
105 os.exit(1); |
|
106 end |
|
107 end |
110 end |
108 |
111 |
109 function sandbox_require() |
112 function sandbox_require() |
110 -- Replace require() with one that doesn't pollute _G, required |
113 -- Replace require() with one that doesn't pollute _G, required |
111 -- for neat sandboxing of modules |
114 -- for neat sandboxing of modules |
440 -- Are you ready? :) |
443 -- Are you ready? :) |
441 -- These actions are in a strict order, as many depend on |
444 -- These actions are in a strict order, as many depend on |
442 -- previous steps to have already been performed |
445 -- previous steps to have already been performed |
443 read_config(); |
446 read_config(); |
444 init_logging(); |
447 init_logging(); |
445 check_dependencies(); |
|
446 sandbox_require(); |
448 sandbox_require(); |
447 set_function_metatable(); |
449 set_function_metatable(); |
448 load_libraries(); |
450 load_libraries(); |
449 init_global_state(); |
451 init_global_state(); |
450 read_version(); |
452 read_version(); |
451 log("info", "Hello and welcome to Prosody version %s", prosody.version); |
453 log("info", "Hello and welcome to Prosody version %s", prosody.version); |
|
454 log_dependency_warnings(); |
452 load_secondary_libraries(); |
455 load_secondary_libraries(); |
453 init_data_store(); |
456 init_data_store(); |
454 init_global_protection(); |
457 init_global_protection(); |
455 prepare_to_start(); |
458 prepare_to_start(); |
456 |
459 |