0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

modules/console: Allow manual JSON to be specified after positional args for listener config.

This commit is contained in:
Jason Volk 2019-03-10 14:25:25 -07:00
parent 7027264ea2
commit 610862903e

View file

@ -4444,23 +4444,26 @@ console_cmd__net__listen(opt &out, const string_view &line)
"private_key_pem_path",
"certificate_pem_path",
"certificate_chain_path",
"tmp_dh_path",
"backlog",
"max_connections",
}};
const json::members opts
const json::members _opts
{
{ "host", token.at("host", "0.0.0.0"_sv) },
{ "port", token.at("port", 8448L) },
{ "private_key_pem_path", token.at("private_key_pem_path") },
{ "certificate_pem_path", token.at("certificate_pem_path") },
{ "certificate_chain_path", token.at("certificate_chain_path", ""_sv) },
{ "tmp_dh_path", token.at("tmp_dh_path", ""_sv) },
{ "backlog", token.at("backlog", -1L) },
{ "max_connections", token.at("max_connections", -1L) },
};
const json::object &addl
{
tokens_after(line, ' ', token.names.size())
};
json::strung opts{_opts};
for(const auto &[name, prop] : addl)
opts = insert(opts, json::member(name, prop));
const auto eid
{
m::send(m::my_room, m::me, "ircd.listen", token.at("name"), opts)