diff --git a/README.md b/README.md index 7f8e20750..30662604e 100644 --- a/README.md +++ b/README.md @@ -160,12 +160,19 @@ in your git repo to the 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: -this is your origin and mxid `@user:host.tld` hostpart. If your DNS uses -`matrix.host.tld` that subdomain is not involved when we refer to -`host.tld` unless we explicitly mention to involve it. +this is your _origin_ and mxid `@user:host.tld` hostpart. If you delegate +your server's location to something like `matrix.host.tld:1234` we refer to +this as your _servername_. + +> Construct clusters all share the same _origin_ but each individual instance +of the daemon has a unique _servername_. 1. Execute + + There are two arguments: ` [servername]`. If the _servername_ + argument is missing, the _origin_ will be used for it instead. + ``` bin/construct host.tld ```` diff --git a/include/ircd/m/self.h b/include/ircd/m/self.h index 28a91827c..418275d3f 100644 --- a/include/ircd/m/self.h +++ b/include/ircd/m/self.h @@ -16,6 +16,7 @@ namespace ircd::m::self struct init; extern std::string origin; + extern std::string servername; extern ed25519::sk secret_key; extern ed25519::pk public_key; extern std::string public_key_b64; @@ -44,7 +45,7 @@ namespace ircd struct ircd::m::self::init { - init(const string_view &origin); + init(const string_view &origin, const string_view &servername); }; inline ircd::string_view diff --git a/ircd/ircd.cc b/ircd/ircd.cc index 758c94de7..e398192cd 100644 --- a/ircd/ircd.cc +++ b/ircd/ircd.cc @@ -11,7 +11,7 @@ namespace ircd { 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 void main() noexcept; @@ -45,7 +45,7 @@ ircd::restart void ircd::init(boost::asio::io_context &user_ios, const string_view &origin, - const string_view &hostname) + const string_view &servername) try { if(run::level != run::level::HALT) @@ -58,7 +58,7 @@ try // Save the params used for m::init later. _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. log::init(); @@ -214,7 +214,7 @@ noexcept try m::init _matrix_ // Matrix { string_view{_origin}, - string_view{_hostname} + string_view{_servername} }; // Any deinits which have to be done with all subsystems intact diff --git a/ircd/m.cc b/ircd/m.cc index 85eeb69bf..257e9b092 100644 --- a/ircd/m.cc +++ b/ircd/m.cc @@ -37,11 +37,11 @@ me_offline_status_msg // ircd::m::init::init(const string_view &origin, - const string_view &hostname) + const string_view &servername) try :_self { - origin + origin, servername } ,_modules { @@ -278,6 +278,10 @@ std::string ircd::m::self::origin {}; +std::string +ircd::m::self::servername +{}; + ircd::ed25519::sk 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 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}; m::me = {ircd_user_id};