mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 23:44:01 +01:00
ircd:Ⓜ️:init: Add optional module list to prevent error propagation.
This commit is contained in:
parent
3780c4c533
commit
85c6fc82c7
1 changed files with 20 additions and 1 deletions
21
ircd/m.cc
21
ircd/m.cc
|
@ -110,6 +110,7 @@ ircd::m::init::close()
|
|||
namespace ircd::m
|
||||
{
|
||||
extern const std::vector<string_view> module_names;
|
||||
extern const std::vector<string_view> module_names_optional;
|
||||
}
|
||||
|
||||
ircd::m::init::modules::modules()
|
||||
|
@ -155,8 +156,18 @@ ircd::m::init::modules::init_imports()
|
|||
return;
|
||||
}
|
||||
|
||||
for(const auto &name : module_name_list)
|
||||
for(const auto &name : module_names) try
|
||||
{
|
||||
mods::imports.emplace(name, name);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
const auto &optional(module_names_optional);
|
||||
if(std::count(begin(optional), end(optional), name))
|
||||
continue;
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
if(db::sequence(*dbs::events) == 0)
|
||||
bootstrap();
|
||||
|
@ -291,6 +302,14 @@ ircd::m::module_names
|
|||
"webroot",
|
||||
};
|
||||
|
||||
/// This is a list of modules that are considered "optional" and any loading
|
||||
/// error for them will not propagate and interrupt m::init.
|
||||
decltype(ircd::m::module_names_optional)
|
||||
ircd::m::module_names_optional
|
||||
{
|
||||
"media_magick",
|
||||
};
|
||||
|
||||
void
|
||||
ircd::m::init::bootstrap()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue