added full support for config file
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Waiting to run
This commit is contained in:
1 parent
0c4183843f
commit
6e85d8e922
21 files changed
+209
-254
No files matched your search
@@ -36,10 +36,6 @@ namespace api
|
||||
response.set_content(R"({"access":"reject"})", JSON_TYPE);
|
||||
return;
|
||||
}
|
||||
// std::ifstream sshportfile(SSH_PORT_PATH);
|
||||
// int ssh_port;
|
||||
// sshportfile >> ssh_port;
|
||||
// sshportfile.close();
|
||||
int ssh_port = config::config.getConfig()["settings"]["ssh"]["port"];
|
||||
std::stringstream responsedata;
|
||||
responsedata << R"({"port":")" << ssh_port << R"("})";
|
||||
@@ -95,10 +91,12 @@ namespace api
|
||||
}
|
||||
std::string syslogstring = "SSH port changed to " + new_ssh_port;
|
||||
syslog(LOG_INFO, "%s", syslogstring.c_str());
|
||||
std::ifstream sshportfile(SSH_PORT_PATH);
|
||||
int ssh_port;
|
||||
sshportfile >> ssh_port;
|
||||
sshportfile.close();
|
||||
config::config.setConfig(std::string("../config.json"));
|
||||
nlohmann::json new_config = config::config.getConfig();
|
||||
new_config["settings"]["ssh"]["port"] = std::stoi(new_ssh_port);
|
||||
config::config.setConfig(new_config);
|
||||
config::config.saveConfig();
|
||||
int ssh_port = config::config.getConfig()["settings"]["ssh"]["port"];
|
||||
std::stringstream responsedata;
|
||||
responsedata << R"({"port":")" << ssh_port << R"("})";
|
||||
response.set_content(responsedata.str(), JSON_TYPE);
|
||||
|
||||
Reference in new issue
Block a user