3 local startup = {}; |
3 local startup = {}; |
4 |
4 |
5 local prosody = { events = require "util.events".new() }; |
5 local prosody = { events = require "util.events".new() }; |
6 |
6 |
7 local config = require "core.configmanager"; |
7 local config = require "core.configmanager"; |
|
8 local async = require "util.async"; |
8 |
9 |
9 local dependencies = require "util.dependencies"; |
10 local dependencies = require "util.dependencies"; |
10 |
11 |
11 function startup.read_config() |
12 function startup.read_config() |
12 local filenames = {}; |
13 local filenames = {}; |
495 startup.init_http_client(); |
496 startup.init_http_client(); |
496 startup.make_dummy_hosts(); |
497 startup.make_dummy_hosts(); |
497 end |
498 end |
498 |
499 |
499 function startup.prosody() |
500 function startup.prosody() |
500 -- These actions are in a strict order, as many depend on |
501 async.once(function () |
501 -- previous steps to have already been performed |
502 -- These actions are in a strict order, as many depend on |
502 startup.read_config(); |
503 -- previous steps to have already been performed |
503 startup.sanity_check(); |
504 startup.read_config(); |
504 startup.sandbox_require(); |
505 startup.sanity_check(); |
505 startup.set_function_metatable(); |
506 startup.sandbox_require(); |
506 startup.check_dependencies(); |
507 startup.set_function_metatable(); |
507 startup.load_libraries(); |
508 startup.check_dependencies(); |
508 startup.init_global_state(); |
509 startup.load_libraries(); |
509 startup.init_logging(); |
510 startup.init_global_state(); |
510 startup.chdir(); |
511 startup.init_logging(); |
511 startup.add_global_prosody_functions(); |
512 startup.chdir(); |
512 startup.read_version(); |
513 startup.add_global_prosody_functions(); |
513 startup.log_greeting(); |
514 startup.read_version(); |
514 startup.log_dependency_warnings(); |
515 startup.log_greeting(); |
515 startup.load_secondary_libraries(); |
516 startup.log_dependency_warnings(); |
516 startup.init_http_client(); |
517 startup.load_secondary_libraries(); |
517 startup.init_data_store(); |
518 startup.init_http_client(); |
518 startup.init_global_protection(); |
519 startup.init_data_store(); |
519 startup.prepare_to_start(); |
520 startup.init_global_protection(); |
520 startup.notify_started(); |
521 startup.prepare_to_start(); |
|
522 startup.notify_started(); |
|
523 end); |
521 end |
524 end |
522 |
525 |
523 return startup; |
526 return startup; |