Software /
code /
prosody
Comparison
util/startup.lua @ 8673:6aeed79d9283
util.startup: Expose make_host() function
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 22 Mar 2018 22:35:39 +0000 |
parent | 8672:86b12ae8d427 |
child | 8682:151ecd18d624 |
comparison
equal
deleted
inserted
replaced
8672:86b12ae8d427 | 8673:6aeed79d9283 |
---|---|
459 print(""); | 459 print(""); |
460 os.exit(1); | 460 os.exit(1); |
461 end | 461 end |
462 end | 462 end |
463 | 463 |
464 function startup.make_host(hostname) | |
465 return { | |
466 type = "local", | |
467 events = prosody.events, | |
468 modules = {}, | |
469 sessions = {}, | |
470 users = require "core.usermanager".new_null_provider(hostname) | |
471 }; | |
472 end | |
473 | |
464 function startup.make_dummy_hosts() | 474 function startup.make_dummy_hosts() |
465 -- When running under prosodyctl, we don't want to | 475 -- When running under prosodyctl, we don't want to |
466 -- fully initialize the server, so we populate prosody.hosts | 476 -- fully initialize the server, so we populate prosody.hosts |
467 -- with just enough things for most code to work correctly | 477 -- with just enough things for most code to work correctly |
468 -- luacheck: ignore 122/hosts | 478 -- luacheck: ignore 122/hosts |
469 prosody.core_post_stanza = function () end; -- TODO: mod_router! | 479 prosody.core_post_stanza = function () end; -- TODO: mod_router! |
470 local function make_host(hostname) | |
471 return { | |
472 type = "local", | |
473 events = prosody.events, | |
474 modules = {}, | |
475 sessions = {}, | |
476 users = require "core.usermanager".new_null_provider(hostname) | |
477 }; | |
478 end | |
479 | 480 |
480 for hostname in pairs(config.getconfig()) do | 481 for hostname in pairs(config.getconfig()) do |
481 hosts[hostname] = make_host(hostname); | 482 hosts[hostname] = startup.make_host(hostname); |
482 end | 483 end |
483 end | 484 end |
484 | 485 |
485 -- prosodyctl only | 486 -- prosodyctl only |
486 function startup.prosodyctl() | 487 function startup.prosodyctl() |