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
27 lines
754 B
C++
27 lines
754 B
C++
#include <settings/dns/dns.hpp>
|
|
#include <syslog.h>
|
|
#include <fstream>
|
|
|
|
namespace api
|
|
{
|
|
namespace settings
|
|
{
|
|
namespace dns
|
|
{
|
|
void set_local_domains(nlohmann::json domains)
|
|
{
|
|
std::ofstream domainsfile("/etc/dnsmasq.conf.d/hosts");
|
|
for (nlohmann::json_abi_v3_11_3::json domain : domains)
|
|
{
|
|
std::string ip = domain["ip"];
|
|
std::string dom = domain["domain"];
|
|
domainsfile << ip << " " << dom << "\n";
|
|
}
|
|
domainsfile.close();
|
|
system("rc restart dnsmasq");
|
|
syslog(LOG_INFO, "%s", "DNS local domains changed");
|
|
}
|
|
}
|
|
}
|
|
}
|