This commit is contained in:
@@ -169,24 +169,36 @@ std::string config::get_template_create_path()
|
||||
|
||||
std::string config::get_backups_path()
|
||||
{
|
||||
return mConfig["backups_path"];
|
||||
nlohmann::json backups_path = mConfig["backups_path"];
|
||||
if (backups_path.empty())
|
||||
return "";
|
||||
if (backups_path.is_string())
|
||||
return backups_path;
|
||||
warning << "backups_path is not a string: " << backups_path << std::endl;
|
||||
return "";
|
||||
}
|
||||
|
||||
dropshell::tRegistryEntry::tRegistryEntry(nlohmann::json json)
|
||||
{
|
||||
valid = false;
|
||||
if (json.is_object() && !json.empty()) {
|
||||
for (auto &[key, value] : json.items()) {
|
||||
if (tolower(key) == "name") {
|
||||
name = value;
|
||||
} else if (tolower(key) == "url") {
|
||||
url = value;
|
||||
} else if (tolower(key) == "token") {
|
||||
token = value;
|
||||
if (value.is_string() && !value.empty())
|
||||
switch (switchhash(key.c_str())) {
|
||||
case switchhash("name"):
|
||||
name = value;
|
||||
break;
|
||||
case switchhash("url"):
|
||||
url = value;
|
||||
break;
|
||||
case switchhash("token"):
|
||||
token = value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
valid = true;
|
||||
} else {
|
||||
valid = false;
|
||||
valid = (!url.empty()&&!name.empty()); // token can be empty.
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user