diff --git a/FlippR-Driver/networking/FlippRServer.cpp b/FlippR-Driver/networking/FlippRServer.cpp index 6e6dd2b..bd9eece 100644 --- a/FlippR-Driver/networking/FlippRServer.cpp +++ b/FlippR-Driver/networking/FlippRServer.cpp @@ -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(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(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."); diff --git a/FlippR-Driver/networking/FlippRServer.h b/FlippR-Driver/networking/FlippRServer.h index 358cc00..54bfaa3 100644 --- a/FlippR-Driver/networking/FlippRServer.h +++ b/FlippR-Driver/networking/FlippRServer.h @@ -53,6 +53,7 @@ private: std::string solenoid_config; std::string sound_config; std::string display_config; + std::string server_config; std::shared_ptr input_driver; std::shared_ptr output_driver;