mirror of
https://github.com/matrix-construct/construct
synced 2024-12-27 07:54:05 +01:00
Add -defaults program option to restore from broken configurations.
This commit is contained in:
parent
71a0ec7532
commit
11f2eff4d9
5 changed files with 22 additions and 1 deletions
|
@ -38,6 +38,7 @@ bool write_avoid;
|
||||||
bool soft_assert;
|
bool soft_assert;
|
||||||
bool nomatrix;
|
bool nomatrix;
|
||||||
bool matrix {true}; // matrix server by default.
|
bool matrix {true}; // matrix server by default.
|
||||||
|
bool defaults;
|
||||||
std::vector<std::string> execute;
|
std::vector<std::string> execute;
|
||||||
std::array<bool, 7> smoketest;
|
std::array<bool, 7> smoketest;
|
||||||
|
|
||||||
|
@ -68,6 +69,7 @@ lgetopt opts[]
|
||||||
{ "sassert", &soft_assert, lgetopt::BOOL, "Softens assertion effects in debug mode."},
|
{ "sassert", &soft_assert, lgetopt::BOOL, "Softens assertion effects in debug mode."},
|
||||||
{ "nomatrix", &nomatrix, lgetopt::BOOL, "Prevent loading the matrix application module."},
|
{ "nomatrix", &nomatrix, lgetopt::BOOL, "Prevent loading the matrix application module."},
|
||||||
{ "matrix", &matrix, lgetopt::BOOL, "Allow loading the matrix application module."},
|
{ "matrix", &matrix, lgetopt::BOOL, "Allow loading the matrix application module."},
|
||||||
|
{ "defaults", &defaults, lgetopt::BOOL, "Use configuration defaults without database load for this execution."},
|
||||||
{ nullptr, nullptr, lgetopt::STRING, nullptr },
|
{ nullptr, nullptr, lgetopt::STRING, nullptr },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -455,6 +457,9 @@ applyargs()
|
||||||
cmdline = true;
|
cmdline = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(defaults)
|
||||||
|
ircd::defaults.set("true");
|
||||||
|
|
||||||
if(read_only)
|
if(read_only)
|
||||||
ircd::read_only.set("true");
|
ircd::read_only.set("true");
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,13 @@ this simply replace the '.' characters with '_' in the name of the item when
|
||||||
setting it in the environment. The name is otherwise the same, including its
|
setting it in the environment. The name is otherwise the same, including its
|
||||||
lower case.
|
lower case.
|
||||||
|
|
||||||
|
Otherwise, the program can be run with the option `-defaults`. This will
|
||||||
|
prevent initial loading of the configuration from the database. It will
|
||||||
|
not prevent environmental variable overrides (as mentioned above). Values
|
||||||
|
will not be written back to the database unless they are explicitly set by
|
||||||
|
the user in the console.
|
||||||
|
|
||||||
|
|
||||||
##### Recovering from database corruption
|
##### Recovering from database corruption
|
||||||
|
|
||||||
In very rare cases after a hard crash the journal cannot completely restore
|
In very rare cases after a hard crash the journal cannot completely restore
|
||||||
|
|
|
@ -111,6 +111,7 @@ namespace ircd
|
||||||
extern conf::item<bool> read_only;
|
extern conf::item<bool> read_only;
|
||||||
extern conf::item<bool> write_avoid;
|
extern conf::item<bool> write_avoid;
|
||||||
extern conf::item<bool> soft_assert;
|
extern conf::item<bool> soft_assert;
|
||||||
|
extern conf::item<bool> defaults;
|
||||||
|
|
||||||
// Informational
|
// Informational
|
||||||
seconds uptime();
|
seconds uptime();
|
||||||
|
|
|
@ -16,6 +16,14 @@ decltype(ircd::conf::on_init)
|
||||||
ircd::conf::on_init
|
ircd::conf::on_init
|
||||||
{};
|
{};
|
||||||
|
|
||||||
|
decltype(ircd::defaults)
|
||||||
|
ircd::defaults
|
||||||
|
{
|
||||||
|
{ "name", "ircd.defaults" },
|
||||||
|
{ "default", false },
|
||||||
|
{ "persist", false },
|
||||||
|
};
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
ircd::conf::reset()
|
ircd::conf::reset()
|
||||||
{
|
{
|
||||||
|
|
|
@ -256,7 +256,7 @@ ircd::m::homeserver::homeserver(const struct opts *const &opts)
|
||||||
if(primary == this)
|
if(primary == this)
|
||||||
vm = std::make_shared<vm::init>();
|
vm = std::make_shared<vm::init>();
|
||||||
|
|
||||||
if(primary == this && conf)
|
if(primary == this && conf && !ircd::defaults)
|
||||||
conf->load();
|
conf->load();
|
||||||
|
|
||||||
if(primary == this && dbs::events && sequence(*dbs::events) == 0)
|
if(primary == this && dbs::events && sequence(*dbs::events) == 0)
|
||||||
|
|
Loading…
Reference in a new issue