mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-10-09 14:55:06 +02:00
fix attempted null -> string conversion
This commit is contained in:
parent
02908e5202
commit
20a67ab1de
1 changed files with 11 additions and 5 deletions
|
@ -680,6 +680,7 @@ void CentralDB::initializeNetworks()
|
||||||
std::optional<uint64_t> created_at = std::get<3>(row);
|
std::optional<uint64_t> created_at = std::get<3>(row);
|
||||||
std::optional<uint64_t> last_modified = std::get<4>(row);
|
std::optional<uint64_t> last_modified = std::get<4>(row);
|
||||||
std::optional<uint64_t> revision = std::get<5>(row);
|
std::optional<uint64_t> revision = std::get<5>(row);
|
||||||
|
std::string frontend = std::get<6>(row);
|
||||||
|
|
||||||
config["id"] = nwid;
|
config["id"] = nwid;
|
||||||
config["name"] = name;
|
config["name"] = name;
|
||||||
|
@ -717,12 +718,17 @@ void CentralDB::initializeNetworks()
|
||||||
config["v6AssignMode"]["rfc4193"] = false;
|
config["v6AssignMode"]["rfc4193"] = false;
|
||||||
}
|
}
|
||||||
config["ssoEnabled"] = cfgtmp["ssoEnabled"].is_boolean() ? cfgtmp["ssoEnabled"].get<bool>() : false;
|
config["ssoEnabled"] = cfgtmp["ssoEnabled"].is_boolean() ? cfgtmp["ssoEnabled"].get<bool>() : false;
|
||||||
|
if (config["ssoConfig"].is_object()) {
|
||||||
|
config["ssoConfig"] = cfgtmp["ssoConfig"];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
config["ssoConfig"] = empty;
|
||||||
|
}
|
||||||
config["objtype"] = "network";
|
config["objtype"] = "network";
|
||||||
config["routes"] = cfgtmp["routes"].is_array() ? cfgtmp["routes"] : json::array();
|
config["routes"] = cfgtmp["routes"].is_array() ? cfgtmp["routes"] : json::array();
|
||||||
config["clientId"] = cfgtmp["clientId"].is_string() ? cfgtmp["clientId"].get<std::string>() : "";
|
config["clientId"] = cfgtmp["clientId"].is_string() ? cfgtmp["clientId"].get<std::string>() : "";
|
||||||
config["authorizationEndpoint"] = cfgtmp["authorizationEndpoint"].is_string()
|
config["authorizationEndpoint"] =
|
||||||
? cfgtmp["authorizationEndpoint"].get<std::string>()
|
cfgtmp["authorizationEndpoint"].is_string() ? cfgtmp["authorizationEndpoint"].get<std::string>() : "";
|
||||||
: nullptr;
|
|
||||||
config["provider"] = cfgtmp["ssoProvider"].is_string() ? cfgtmp["ssoProvider"].get<std::string>() : "";
|
config["provider"] = cfgtmp["ssoProvider"].is_string() ? cfgtmp["ssoProvider"].get<std::string>() : "";
|
||||||
if (! cfgtmp["dns"].is_object()) {
|
if (! cfgtmp["dns"].is_object()) {
|
||||||
cfgtmp["dns"] = json::object();
|
cfgtmp["dns"] = json::object();
|
||||||
|
@ -734,7 +740,7 @@ void CentralDB::initializeNetworks()
|
||||||
}
|
}
|
||||||
config["ipAssignmentPools"] =
|
config["ipAssignmentPools"] =
|
||||||
cfgtmp["ipAssignmentPools"].is_array() ? cfgtmp["ipAssignmentPools"] : json::array();
|
cfgtmp["ipAssignmentPools"].is_array() ? cfgtmp["ipAssignmentPools"] : json::array();
|
||||||
config["frontend"] = std::get<6>(row);
|
config["frontend"] = frontend;
|
||||||
|
|
||||||
Metrics::network_count++;
|
Metrics::network_count++;
|
||||||
|
|
||||||
|
@ -742,7 +748,7 @@ void CentralDB::initializeNetworks()
|
||||||
|
|
||||||
auto end = std::chrono::high_resolution_clock::now();
|
auto end = std::chrono::high_resolution_clock::now();
|
||||||
auto dur = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
|
auto dur = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
|
||||||
;
|
|
||||||
total += dur.count();
|
total += dur.count();
|
||||||
++count;
|
++count;
|
||||||
if (count > 0 && count % 10000 == 0) {
|
if (count > 0 && count % 10000 == 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue