0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd:Ⓜ️:self: Add the servername string to this section; update README.

This commit is contained in:
Jason Volk 2019-03-28 13:07:30 -07:00
parent cc99bd9adf
commit d47518a102
4 changed files with 26 additions and 12 deletions

View file

@ -160,12 +160,19 @@ in your git repo to the library path:
`export LD_LIBRARY_PATH=/path/to/src/deps/rocksdb:$LD_LIBRARY_PATH` `export LD_LIBRARY_PATH=/path/to/src/deps/rocksdb:$LD_LIBRARY_PATH`
- We will refer to your server as `host.tld`. For those familiar with matrix: - We will refer to your server as `host.tld`. For those familiar with matrix:
this is your origin and mxid `@user:host.tld` hostpart. If your DNS uses this is your _origin_ and mxid `@user:host.tld` hostpart. If you delegate
`matrix.host.tld` that subdomain is not involved when we refer to your server's location to something like `matrix.host.tld:1234` we refer to
`host.tld` unless we explicitly mention to involve it. this as your _servername_.
> Construct clusters all share the same _origin_ but each individual instance
of the daemon has a unique _servername_.
1. Execute 1. Execute
There are two arguments: `<origin> [servername]`. If the _servername_
argument is missing, the _origin_ will be used for it instead.
``` ```
bin/construct host.tld bin/construct host.tld
```` ````

View file

@ -16,6 +16,7 @@ namespace ircd::m::self
struct init; struct init;
extern std::string origin; extern std::string origin;
extern std::string servername;
extern ed25519::sk secret_key; extern ed25519::sk secret_key;
extern ed25519::pk public_key; extern ed25519::pk public_key;
extern std::string public_key_b64; extern std::string public_key_b64;
@ -44,7 +45,7 @@ namespace ircd
struct ircd::m::self::init struct ircd::m::self::init
{ {
init(const string_view &origin); init(const string_view &origin, const string_view &servername);
}; };
inline ircd::string_view inline ircd::string_view

View file

@ -11,7 +11,7 @@
namespace ircd namespace ircd
{ {
std::string _origin; // user's supplied param std::string _origin; // user's supplied param
std::string _hostname; // user's supplied param std::string _servername; // user's supplied param
ctx::ctx *main_context; // Main program loop ctx::ctx *main_context; // Main program loop
void main() noexcept; void main() noexcept;
@ -45,7 +45,7 @@ ircd::restart
void void
ircd::init(boost::asio::io_context &user_ios, ircd::init(boost::asio::io_context &user_ios,
const string_view &origin, const string_view &origin,
const string_view &hostname) const string_view &servername)
try try
{ {
if(run::level != run::level::HALT) if(run::level != run::level::HALT)
@ -58,7 +58,7 @@ try
// Save the params used for m::init later. // Save the params used for m::init later.
_origin = std::string{origin}; _origin = std::string{origin};
_hostname = std::string{hostname}; _servername = std::string{servername};
// The log is available. but it is console-only until conf opens files. // The log is available. but it is console-only until conf opens files.
log::init(); log::init();
@ -214,7 +214,7 @@ noexcept try
m::init _matrix_ // Matrix m::init _matrix_ // Matrix
{ {
string_view{_origin}, string_view{_origin},
string_view{_hostname} string_view{_servername}
}; };
// Any deinits which have to be done with all subsystems intact // Any deinits which have to be done with all subsystems intact

View file

@ -37,11 +37,11 @@ me_offline_status_msg
// //
ircd::m::init::init(const string_view &origin, ircd::m::init::init(const string_view &origin,
const string_view &hostname) const string_view &servername)
try try
:_self :_self
{ {
origin origin, servername
} }
,_modules ,_modules
{ {
@ -278,6 +278,10 @@ std::string
ircd::m::self::origin ircd::m::self::origin
{}; {};
std::string
ircd::m::self::servername
{};
ircd::ed25519::sk ircd::ed25519::sk
ircd::m::self::secret_key ircd::m::self::secret_key
{}; {};
@ -393,9 +397,11 @@ extern ircd::m::room::id::buf users_room_id;
extern ircd::m::room::id::buf tokens_room_id; extern ircd::m::room::id::buf tokens_room_id;
extern ircd::m::room::id::buf nodes_room_id; extern ircd::m::room::id::buf nodes_room_id;
ircd::m::self::init::init(const string_view &origin) ircd::m::self::init::init(const string_view &origin,
const string_view &servername)
{ {
self::origin = std::string{origin}; self::origin = origin;
self::servername = servername;
ircd_user_id = {"ircd", origin}; ircd_user_id = {"ircd", origin};
m::me = {ircd_user_id}; m::me = {ircd_user_id};