0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-23 12:28:20 +02:00

ircd: Add conf item to convey contextual diagnostic options.

This commit is contained in:
Jason Volk 2020-09-27 14:44:33 -07:00
parent 42fd88d169
commit 3fedfaeb8d
3 changed files with 23 additions and 0 deletions

View file

@ -46,6 +46,7 @@ bool nomatrix;
bool matrix {true}; // matrix server by default.
bool defaults;
const char *bootstrap;
const char *diagnostic;
lgetopt opts[]
{
@ -80,6 +81,7 @@ lgetopt opts[]
{ "matrix", &matrix, lgetopt::BOOL, "Allow loading the matrix application module" },
{ "defaults", &defaults, lgetopt::BOOL, "Use configuration defaults without database load for this execution" },
{ "bootstrap", &bootstrap, lgetopt::STRING, "Bootstrap fresh database from event vector" },
{ "diagnostic", &diagnostic, lgetopt::STRING, "Specify a diagnostic type in conjunction with other commands" },
{ nullptr, nullptr, lgetopt::STRING, nullptr },
};
@ -477,6 +479,9 @@ enable_coredumps()
void
applyargs()
{
if(diagnostic)
ircd::diagnostic.set(diagnostic);
if(single && !bootstrap)
{
ircd::write_avoid.set("true");

View file

@ -111,6 +111,9 @@ namespace ircd
extern const info::versions version_api;
extern const info::versions version_abi;
// Diagnostic Mode Options
extern conf::item<std::string> diagnostic;
// Operating Mode Selectors
extern conf::item<bool> restart;
extern conf::item<bool> debugmode;

View file

@ -140,6 +140,21 @@ ircd::read_only
}
};
/// Diagnostic options selection. This indicates whether any tests or special
/// behavior should occur rather than normal operation; also allowing for
/// fine-grained options to be conveyed to such tests/diagnostics. While this
/// appears here as coarse library-wide option it does not on its own affect
/// normal server operations just by being set. It affect things only if
/// specific functionality checks and alters its behavior based on the value
/// of this string contextually.
decltype(ircd::diagnostic)
ircd::diagnostic
{
{ "name", "ircd.diagnostic" },
{ "default", string_view{} },
{ "persist", false },
};
/// Main context pointer placement.
decltype(ircd::main_context)
ircd::main_context;