0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-01 19:22:53 +01:00

ircd:Ⓜ️:self::init: Fix keys init; prevent libircd as dependency for module.

This commit is contained in:
Jason Volk 2019-06-21 20:27:30 -07:00
parent 33bb845eb7
commit 4093dc2f85
3 changed files with 18 additions and 6 deletions

View file

@ -49,6 +49,7 @@ struct ircd::m::self::init
{ {
static void federation_ed25519(); static void federation_ed25519();
static void tls_certificate(); static void tls_certificate();
static void keys();
init(const string_view &origin, const string_view &servername); init(const string_view &origin, const string_view &servername);
}; };

View file

@ -530,9 +530,11 @@ ircd::m::self::init::init(const string_view &origin,
"The origin is configured or has defaulted to 'localhost'" "The origin is configured or has defaulted to 'localhost'"
}; };
// Loading the keys module in runlevel::START will do further
// inits of m::self::globals. Calling the inits directly from
// here makes the module dependent on libircd and unloadable.
assert(ircd::run::level == run::level::START);
mods::imports.emplace("s_keys"s, "s_keys"s); mods::imports.emplace("s_keys"s, "s_keys"s);
federation_ed25519();
tls_certificate();
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View file

@ -12,6 +12,7 @@ ircd::mapi::header
IRCD_MODULE IRCD_MODULE
{ {
"Server keys" "Server keys"
,ircd::m::self::init::keys
}; };
bool bool
@ -431,15 +432,23 @@ noexcept
// m/self.h // m/self.h
// //
//
// self::init
//
void
IRCD_MODULE_EXPORT
ircd::m::self::init::keys()
{
tls_certificate();
federation_ed25519();
}
namespace ircd::m::self namespace ircd::m::self
{ {
extern conf::item<std::string> tls_key_dir; extern conf::item<std::string> tls_key_dir;
} }
//
// self::init
//
decltype(ircd::m::self::tls_key_dir) decltype(ircd::m::self::tls_key_dir)
ircd::m::self::tls_key_dir ircd::m::self::tls_key_dir
{ {