13 using std::runtime_error::runtime_error;
57 static Config load(
const std::string& path,
int argc = 0,
char* argv[] =
nullptr,
a class to store JSON values
Definition json.hpp:19401
A configuration problem, naming the key path ("server.port: ...").
Definition ConfigFile.hpp:11
An application's configuration: a JSON file, then ORBIT_* environment variables, then command-line fl...
Definition ConfigFile.hpp:48
nlohmann::json document_
Definition ConfigFile.hpp:75
const nlohmann::json & document() const
The whole document after environment overrides.
Definition ConfigFile.hpp:69
const nlohmann::json & section(const std::string &name) const
static Config from_json(nlohmann::json document, int argc=0, char *argv[]=nullptr, ServerConfig::ParseMode mode=ServerConfig::ParseMode::Lenient)
As load(), from a document already in memory (tests, generated config).
ServerConfig server
Definition ConfigFile.hpp:50
static ServerConfig server_from_json(const nlohmann::json &server_section)
The server section as a ServerConfig (strictly validated).
static Config load(const std::string &path, int argc=0, char *argv[]=nullptr, ServerConfig::ParseMode mode=ServerConfig::ParseMode::Lenient)
Reads path, applies the environment, then the command line (as ServerConfig::parse(); pass argc = 0 f...
ParseMode
How parse() treats a flag it does not know.
Definition Config.hpp:90
@ Lenient
Report it on stderr and carry on: the application may handle its own flags.