mirror of
https://github.com/matrix-construct/construct
synced 2024-10-01 05:08:59 +02:00
modules/s_conf: Provide linkage for conf "rehash" w/ console cmd.
This commit is contained in:
parent
3746c25f20
commit
42af033421
2 changed files with 33 additions and 5 deletions
|
@ -631,6 +631,23 @@ console_cmd__conf__get(opt &out, const string_view &line)
|
|||
};
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__conf__rehash(opt &out, const string_view &line)
|
||||
{
|
||||
using prototype = void ();
|
||||
static m::import<prototype> rehash_conf
|
||||
{
|
||||
"s_conf", "rehash_conf"
|
||||
};
|
||||
|
||||
rehash_conf();
|
||||
out << "Updated any runtime conf items"
|
||||
<< " from the current state in !conf:" << my_host()
|
||||
<< std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// hook
|
||||
//
|
||||
|
|
|
@ -10,10 +10,15 @@
|
|||
|
||||
using namespace ircd;
|
||||
|
||||
extern "C" void rehash_conf();
|
||||
|
||||
mapi::header
|
||||
IRCD_MODULE
|
||||
{
|
||||
"Server Configuration"
|
||||
"Server Configuration", []
|
||||
{
|
||||
rehash_conf();
|
||||
}
|
||||
};
|
||||
|
||||
const m::room::id::buf
|
||||
|
@ -56,7 +61,7 @@ get_conf_item(const string_view &key,
|
|||
}
|
||||
|
||||
static void
|
||||
update_conf(const m::event &event)
|
||||
conf_updated(const m::event &event)
|
||||
noexcept try
|
||||
{
|
||||
const auto &content
|
||||
|
@ -92,9 +97,9 @@ catch(const std::exception &e)
|
|||
}
|
||||
|
||||
const m::hook
|
||||
update_conf_hook
|
||||
conf_updated_hook
|
||||
{
|
||||
update_conf,
|
||||
conf_updated,
|
||||
{
|
||||
{ "_site", "vm.notify" },
|
||||
{ "room_id", "!conf" },
|
||||
|
@ -113,7 +118,7 @@ init_conf_items(const m::event &)
|
|||
state.for_each("ircd.conf.item", []
|
||||
(const m::event &event)
|
||||
{
|
||||
update_conf(event);
|
||||
conf_updated(event);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -130,6 +135,12 @@ init_conf_items_hook
|
|||
}
|
||||
};
|
||||
|
||||
void
|
||||
rehash_conf()
|
||||
{
|
||||
init_conf_items(m::event{});
|
||||
}
|
||||
|
||||
static void
|
||||
create_conf_item(const string_view &key,
|
||||
const conf::item<> &item)
|
||||
|
|
Loading…
Reference in a new issue