changed server config parsing

This commit is contained in:
Jonas Zeunert
2019-07-30 23:31:47 +02:00
parent 3d20793a81
commit f80943b732
2 changed files with 10 additions and 1 deletions

View File

@@ -57,7 +57,7 @@ void FlippRServer::parse_server_config_file()
try
{
config.open("./server_config.json");
config.open(this->server_config);
}
catch(const std::exception e)
{
@@ -249,6 +249,12 @@ void FlippRServer::defineOptions(OptionSet& options)
.repeatable(false)
.callback(OptionCallback<FlippRServer>(this, &FlippRServer::handle_config_file))
.argument("display-config", true));
options.addOption(Option("server-config", "-s", "Specify where the server-config file is located. Only needed when not in this folder.")
.required(this->display_config == "Not set")
.repeatable(false)
.callback(OptionCallback<FlippRServer>(this, &FlippRServer::handle_config_file))
.argument("server-config", true));
}
void FlippRServer::handle_config_file(const std::string &name, const std::string &value)
@@ -269,6 +275,8 @@ void FlippRServer::handle_config_file(const std::string &name, const std::string
this->input_port = std::stoi(value);
else if(name == "output-port")
this->output_port = std::stoi(value);
else if(name == "server-config")
this->server_config = value;
else
{
logger().information("Configuration \"" + name + "\" is not known.");