You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
656 B
27 lines
656 B
#include "config.hpp"
|
|
#include <fstream>
|
|
|
|
using namespace nlohmann;
|
|
|
|
Config::Config(const string json_file) {
|
|
load(json_file);
|
|
}
|
|
|
|
void Config::load(const string file_name) {
|
|
std::ifstream infile(file_name);
|
|
json_config = json::parse(infile);
|
|
|
|
listen_at = json_config["listen_at"].template get<string>();
|
|
fail_max = json_config["fail_max"].template get<int>();
|
|
json send_list = json_config["send_to"];
|
|
|
|
for(auto &el : send_list.items()) {
|
|
json spec = el.value();
|
|
SendTo send_spec{
|
|
.url = spec["url"].template get<string>(),
|
|
.bitrate = spec["bitrate"].template get<string>()
|
|
};
|
|
|
|
send_to[el.key()] = send_spec;
|
|
}
|
|
}
|
|
|